QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#6268. 指点江山

统计

给定一个序列 $a_1,a_2,\dots,a_n$,你可以进行任意多次如下操作:

  • 选择 $i$,将 $a_i$ 替换成 $-(a_1+a_2+\cdots+a_n)$。

试求,你能得到的字典序最小的 $a$ 序列是什么?

输入格式

第一行输入一个正整数 $n$。

接下来一行输入 $n$ 个整数,从小到大表示 $a_i$。

输出格式

输出一行 $n$ 个整数,表示字典序最小的序列。

样例数据

样例输入

3
2 -3 2

样例输出

-3 -1 2

样例解释

$[2,-3,2] \to [2, -1, 2] \to [-3, -1, 2]$

子任务

对于 $100\%$ 的数据,保证 $1\leq n\leq 10^5$,$|a_i|\leq 10^9$。

对于测试点 $1\sim 4$,保证 $n\leq 5$。

对于测试点 $5\sim 7$,保证 $n\leq 10^3$。

对于测试点 $8\sim 10$,无特殊限制。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.