CF81C.Average Score

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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).

教育改革后,Polycarp 在学校只学习两门课程:安全教育(Safety Studies)和体育(PE,Physical Education)。在漫长的第四学期中,他在这两门课上共获得了 nn 个成绩。老师在记分册上登记成绩时,并未注明该成绩对应哪门课程,而只是写下了成绩数值。

现在到了向他严厉的父母展示记分册的时候了。Polycarp 知道,在最近一次家长会上,老师告诉父母:他在安全教育课上获得了 aa 个成绩,在体育课上获得了 bb 个成绩(满足 a+b=na + b = n)。现在 Polycarp 想要在每个成绩前标注对应的课程名称,使得:

  • 安全教育课的成绩恰好有 aa 个,
  • 体育课的成绩恰好有 bb 个,
  • 两门课程的平均分之和达到最大。

一门课程的平均分定义为该课程所有成绩之和除以该课程的成绩数量。当然,该除法在实数范围内进行,不作向上或向下取整。Polycarp 的目标是最大化 x1+x2x_1 + x_2,其中 x1x_1 是第一门课程(安全教育)的平均分,x2x_2 是第二门课程(体育)的平均分。

输入格式

The first line contains an integer n (2 ≤ n ≤ 105), 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.

第一行包含一个整数 nn(2≤n≤1052 \leq n \leq 10^5),表示 Polycarp 日记中的成绩数量。
第二行包含两个正整数 aa、bb(1≤a,b≤n−11 \leq a, b \leq n-1,且 a+b=na + b = n)。
第三行包含一个整数序列 t1,t2,…,tnt_1, t_2, \dots, t_n(1≤ti≤51 \leq t_i \leq 5),表示 Polycarp 的成绩。

输出格式

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.

输出整数序列 f1, f2, …, fnf_1,\,f_2,\,\dots,\,f_n,其中 fif_i(1≤fi≤21\le f_i\le 2)表示第 ii 个成绩应归属的科目编号。若存在多种可行解,则输出字典序最小的序列 f1, f2, …, fnf_1,\,f_2,\,\dots,\,f_n。

序列 p1, p2, …, pnp_1,\,p_2,\,\dots,\,p_n 的字典序小于序列 q1, q2, …, qnq_1,\,q_2,\,\dots,\,q_n,当且仅当存在某个 jj(1≤j≤n1\le j\le n),使得对所有 1≤i<j1\le i<j 均有 pi=qip_i=q_i,且 pj<qjp_j<q_j。

输入输出样例

  • 输入#1

    5
    3 2
    4 4 5 4 4

    输出#1

    1 1 2 1 2
  • 输入#2

    4
    2 2
    3 5 4 5

    输出#2

    1 1 2 2
  • 输入#3

    6
    1 5
    4 4 4 5 4 4

    输出#3

    2 2 2 1 2 2

说明/提示

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.

在第一个样例中,第一门科目的平均分为 4,第二门科目为 4.5。总平均分为 8.5。

输入解题思路,AI测评打分。不知道怎么写?

首页