CF1237A.Balanced Rating Changes
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Another Codeforces Round has just finished! It has gathered n participants, and according to the results, the expected rating change of participant i is ai . These rating changes are perfectly balanced — their sum is equal to 0 .
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 i , their modified rating change bi must be integer, and as close to 2ai as possible. It means that either bi=⌊2ai⌋ or bi=⌈2ai⌉ . In particular, if ai is even, bi=2ai . Here ⌊x⌋ denotes rounding down to the largest integer not greater than x , and ⌈x⌉ denotes rounding up to the smallest integer not smaller than x .
- The modified rating changes must be perfectly balanced — their sum must be equal to 0 .
Can you help with that?
输入格式
The first line contains a single integer n ( 2≤n≤13845 ), denoting the number of participants.
Each of the next n lines contains a single integer ai ( −336≤ai≤1164 ), denoting the rating change of the i -th participant.
The sum of all ai is equal to 0 .
输出格式
Output n integers bi , each denoting the modified rating change of the i -th participant in order of input.
For any i , it must be true that either bi=⌊2ai⌋ or bi=⌈2ai⌉ . The sum of all bi must be equal to 0 .
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=5 , b2=−3 and b3=−2 is another correct solution.
In the second example there are 6 possible solutions, one of them is shown in the example output.