CF847F.Berland Elections

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The elections to Berland parliament are happening today. Voting is in full swing!

Totally there are nn candidates, they are numbered from 11 to nn . Based on election results kk ( 1<=k<=n1<=k<=n ) top candidates will take seats in the parliament.

After the end of the voting the number of votes for each candidate is calculated. In the resulting table the candidates are ordered by the number of votes. In case of tie (equal number of votes) they are ordered by the time of the last vote given. The candidate with ealier last vote stands higher in the resulting table.

So in the resulting table candidates are sorted by the number of votes (more votes stand for the higher place) and if two candidates have equal number of votes they are sorted by the time of last vote (earlier last vote stands for the higher place).

There is no way for a candidate with zero votes to take a seat in the parliament. So it is possible that less than kk candidates will take a seat in the parliament.

In Berland there are mm citizens who can vote. Each of them will vote for some candidate. Each citizen will give a vote to exactly one of nn candidates. There is no option "against everyone" on the elections. It is not accepted to spoil bulletins or not to go to elections. So each of mm citizens will vote for exactly one of nn candidates.

At the moment aa citizens have voted already ( 1<=a<=m1<=a<=m ). This is an open election, so for each citizen it is known the candidate for which the citizen has voted. Formally, the jj -th citizen voted for the candidate gjg_{j} . The citizens who already voted are numbered in chronological order; i.e. the (j+1)(j+1) -th citizen voted after the jj -th.

The remaining mam-a citizens will vote before the end of elections, each of them will vote for one of nn candidates.

Your task is to determine for each of nn candidates one of the three possible outcomes:

  • a candidate will be elected to the parliament regardless of votes of the remaining mam-a citizens;
  • a candidate has chance to be elected to the parliament after all nn citizens have voted;
  • a candidate has no chances to be elected to the parliament regardless of votes of the remaining mam-a citizens.

输入格式

The first line contains four integers nn , kk , mm and aa ( 1<=k<=n<=1001<=k<=n<=100 , 1<=m<=1001<=m<=100 , 1<=a<=m1<=a<=m ) — the number of candidates, the number of seats in the parliament, the number of Berland citizens and the number of citizens who already have voted.

The second line contains a sequence of aa integers g1,g2,...,gag_{1},g_{2},...,g_{a} ( 1<=gj<=n1<=g_{j}<=n ), where gjg_{j} is the candidate for which the jj -th citizen has voted. Citizens who already voted are numbered in increasing order of voting times.

输出格式

Print the sequence consisting of nn integers r1,r2,...,rnr_{1},r_{2},...,r_{n} where:

  • ri=1r_{i}=1 means that the ii -th candidate is guaranteed to take seat in the parliament regardless of votes of the remaining mam-a citizens;
  • ri=2r_{i}=2 means that the ii -th candidate has a chance to take a seat in the parliament, i.e. the remaining mam-a citizens can vote in such a way that the candidate will take a seat in the parliament;
  • ri=3r_{i}=3 means that the ii -th candidate will not take a seat in the parliament regardless of votes of the remaining mam-a citizens.

输入输出样例

  • 输入#1

    3 1 5 4
    1 2 1 3
    

    输出#1

    1 3 3 
  • 输入#2

    3 1 5 3
    1 3 1
    

    输出#2

    2 3 2 
  • 输入#3

    3 2 5 3
    1 3 1
    

    输出#3

    1 2 2 
首页