欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1237A.Balanced Rating Changes
Balanced Rating Changes
Another Codeforces Round has just finished! It has gathered participants, and according to the results, the expected rating change of participant is . These rating changes are perfectly balanced — their sum is equal to .
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 , their modified rating change must be integer, and as close to as possible. It means that either or . In particular, if is even, . Here denotes rounding down to the largest integer not greater than , and denotes rounding up to the smallest integer not smaller than .
- The modified rating changes must be perfectly balanced — their sum must be equal to .
Can you help with that?
Input
The first line contains a single integer (), denoting the number of participants.
Each of the next lines contains a single integer (), denoting the rating change of the -th participant.
The sum of all is equal to .
Output
Output integers , each denoting the modified rating change of the -th participant in order of input.
For any , it must be true that either or . The sum of all must be equal to .
If there are multiple solutions, print any. We can show that a solution exists for any valid input.
Note
In the first example, , and is another correct solution.
In the second example there are possible solutions, one of them is shown in the example output.
Samples
3
10
-5
-5
5
-2
-3
7
-7
-29
0
3
24
-29
38
-3
-15
0
2
12
-15
19
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |