CF1237A.Balanced Rating Changes

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Another Codeforces Round has just finished! It has gathered nn participants, and according to the results, the expected rating change of participant ii is aia_i . These rating changes are perfectly balanced — their sum is equal to 00 .

Unfortunately, due to minor technical glitches, the round is declared semi-rated. It means that all rating changes must be divided by two.

There are two conditions though:

  • For each participant ii , their modified rating change bib_i must be integer, and as close to ai2\frac{a_i}{2} as possible. It means that either bi=ai2b_i = \lfloor \frac{a_i}{2} \rfloor or bi=ai2b_i = \lceil \frac{a_i}{2} \rceil . In particular, if aia_i is even, bi=ai2b_i = \frac{a_i}{2} . Here x\lfloor x \rfloor denotes rounding down to the largest integer not greater than xx , and x\lceil x \rceil denotes rounding up to the smallest integer not smaller than xx .
  • The modified rating changes must be perfectly balanced — their sum must be equal to 00 .

Can you help with that?

输入格式

The first line contains a single integer nn ( 2n138452 \le n \le 13\,845 ), denoting the number of participants.

Each of the next nn lines contains a single integer aia_i ( 336ai1164-336 \le a_i \le 1164 ), denoting the rating change of the ii -th participant.

The sum of all aia_i is equal to 00 .

输出格式

Output nn integers bib_i , each denoting the modified rating change of the ii -th participant in order of input.

For any ii , it must be true that either bi=ai2b_i = \lfloor \frac{a_i}{2} \rfloor or bi=ai2b_i = \lceil \frac{a_i}{2} \rceil . The sum of all bib_i must be equal to 00 .

If there are multiple solutions, print any. We can show that a solution exists for any valid input.

输入输出样例

  • 输入#1

    3
    10
    -5
    -5
    

    输出#1

    5
    -2
    -3
    
  • 输入#2

    7
    -7
    -29
    0
    3
    24
    -29
    38
    

    输出#2

    -3
    -15
    0
    2
    12
    -15
    19
    

说明/提示

In the first example, b1=5b_1 = 5 , b2=3b_2 = -3 and b3=2b_3 = -2 is another correct solution.

In the second example there are 66 possible solutions, one of them is shown in the example output.

首页