Yandex.Algorithm Open 2011: Qualification 1
C
Average Score
Codeforces
1700
原题
← BD →
翻译中…

After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received $*n*$ marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.

翻译中…

Now it's time to show the journal to his strict parents. Polycarp knows that recently at the Parent Meeting the parents were told that he received $*a*$ Safety Studies marks and $*b*$ PE marks ($*a* + *b* = *n*$). Now Polycarp wants to write a subject's name in front of each mark so that:

翻译中…
  • there are exactly $*a*$ Safety Studies marks,
  • there are exactly $*b*$ PE marks,
  • the total average score in both subjects is maximum.
翻译中…

An average subject grade is the sum of all marks in it, divided by the number of them. Of course, the division is performed in real numbers without rounding up or down. Polycarp aims to maximize the $*x*_{1} + *x*_{2}$, where $*x*_{1}$ is the average score in the first subject (Safety Studies), and $*x*_{2}$ is the average score in the second one (Physical Education).

翻译中…

Input

翻译中…

The first line contains an integer $*n*$ ($2 ≤ *n* ≤ 10^{5}$), $*n*$ is the number of marks in Polycarp's Journal. The second line contains two positive integers $*a*, *b*$ ($1 ≤ *a*, *b* ≤ *n* - 1, *a* + *b* = *n*$). The third line contains a sequence of integers $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$ ($1 ≤ *t*_{*i*} ≤ 5$), they are Polycarp's marks.

翻译中…

Output

翻译中…

Print the sequence of integers $*f*_{1}, *f*_{2}, ..., *f*_{*n*}$, where $*f*_{*i*}$ ($1 ≤ *f*_{*i*} ≤ 2$) is the number of a subject to which the $*i*$-th mark should be attributed. If there are several possible solutions, then print such that the sequence $*f*_{1}, *f*_{2}, ..., *f*_{*n*}$ is the smallest lexicographically.

翻译中…

The sequence $*p*_{1}, *p*_{2}, ..., *p*_{*n*}$ is lexicographically less than $*q*_{1}, *q*_{2}, ..., *q*_{*n*}$ if there exists such $*j*$ ($1 ≤ *j* ≤ *n*$) that $*p*_{*i*} = *q*_{*i*}$ for all $1 ≤ *i* < *j*$, аnd $*p*_{*j*} < *q*_{*j*}$.

翻译中…

Note

翻译中…

In the first sample the average score in the first subject is equal to 4, and in the second one — to 4.5. The total average score is 8.5.

翻译中…

样例

Input #1
5
3 2
4 4 5 4 4
Output #1
1 1 2 1 2
InputCopy OutputCopy
Input #2
4
2 2
3 5 4 5
Output #2
1 1 2 2
InputCopy OutputCopy
Input #3
6
1 5
4 4 4 5 4 4
Output #3
2 2 2 1 2 2
InputCopy OutputCopy
题目信息
题号
81C
时间限制
2 s
内存限制
256 MB
标签
贪心
数学
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。