欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1252A.Copying Homework
Copying Homework
Danang and Darto are classmates. They are given homework to create a permutation of integers from to . Danang has completed the homework and created a permutation of integers. Darto wants to copy Danang's homework, but Danang asks Darto to change it up a bit so it does not look obvious that Darto copied.
The difference of two permutations of integers and , denoted by , is the sum of the absolute difference of and for all . In other words, . Darto would like to create a permutation of integers that maximizes its difference with . Formally, he wants to find a permutation of integers such that for all permutation of integers .
Darto needs your help! Since the teacher giving the homework is lenient, any permutation of integers is considered different with if the difference of and is at least . Therefore, you are allowed to return any permutation of integers such that .
Of course, you can still return if you want, since it can be proven that for any permutation and . This also proves that there exists a solution for any permutation of integers . If there is more than one valid solution, you can output any of them.
Input
Input begins with a line containing an integer: () representing the size of Danang's permutation. The next line contains integers: () representing Danang's permutation. It is guaranteed that all elements in are distinct.
Output
Output in a line integers (each separated by a single space) representing the permutation of integers such that . As a reminder, all elements in the permutation must be between to and distinct.
Note
Explanation for the sample input/output #1
With and , $diff(A, B) = |1 - 4| + |3 - 2| + |2 - 3| + |4 - 1| = 3 + 1 + 1 + 3 = 8$. Since , is one of the valid output for this sample.
Samples
4
1 3 2 4
4 2 3 1
2
2 1
1 2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |