A9003 | Sereja and Contest
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
During the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants.
Let's assume that $n$ people took part in the contest. Let's assume that the participant who got the first place has rating $a_{1}$ , the second place participant has rating $a_{2}$ , $...$ , the $n$ -th place participant has rating $a_{n}$ . Then changing the rating on the Codesecrof site is calculated by the formula .
After the round was over, the Codesecrof management published the participants' results table. They decided that if for a participant $d_{i}<k$ , then the round can be considered unrated for him. But imagine the management's surprise when they found out that the participants' rating table is dynamic. In other words, when some participant is removed from the rating, he is removed from the results' table and the rating is recalculated according to the new table. And of course, all applications for exclusion from the rating are considered in view of the current table.
We know that among all the applications for exclusion from the rating the first application to consider is from the participant with the best rank (the rank with the minimum number), for who $d_{i}<k$ . We also know that the applications for exclusion from rating were submitted by all participants.
Now Sereja wonders, what is the number of participants to be excluded from the contest rating, and the numbers of the participants in the original table in the order of their exclusion from the rating. Pay attention to the analysis of the first test case for a better understanding of the statement.
Let's assume that $n$ people took part in the contest. Let's assume that the participant who got the first place has rating $a_{1}$ , the second place participant has rating $a_{2}$ , $...$ , the $n$ -th place participant has rating $a_{n}$ . Then changing the rating on the Codesecrof site is calculated by the formula .
After the round was over, the Codesecrof management published the participants' results table. They decided that if for a participant $d_{i}<k$ , then the round can be considered unrated for him. But imagine the management's surprise when they found out that the participants' rating table is dynamic. In other words, when some participant is removed from the rating, he is removed from the results' table and the rating is recalculated according to the new table. And of course, all applications for exclusion from the rating are considered in view of the current table.
We know that among all the applications for exclusion from the rating the first application to consider is from the participant with the best rank (the rank with the minimum number), for who $d_{i}<k$ . We also know that the applications for exclusion from rating were submitted by all participants.
Now Sereja wonders, what is the number of participants to be excluded from the contest rating, and the numbers of the participants in the original table in the order of their exclusion from the rating. Pay attention to the analysis of the first test case for a better understanding of the statement.
输入格式
The first line contains two integers $n$ , $k$ $(1<=n<=2·10^{5},-10^{9}<=k<=0)$ . The second line contains $n$ space-separated integers $a_{1},a_{2},...,a_{n}$ $(1<=a_{i}<=10^{9})$ — ratings of the participants in the initial table.
输出格式
Print the numbers of participants in the order in which they were removed from the table. Print the initial numbers of the participants, that is, the numbers that the participants had in the initial table.
输入输出样例
输入 #1
5 0 5 3 4 1 2
输出 #1
2 3 4
输入 #2
10 -10 5 5 1 7 5 1 2 4 9 2
输出 #2
2 4 5 7 8 9
Consider the first test sample.
1. Initially the sequence of the contest participants' ratings equals \[5, 3, 4, 1, 2\]. You can use this sequence to calculate the sequence of rating changes: \[0, -9, -13, 8, 14\]. According to the problem statement, the application of the participant who won the second place will be considered first.
2. As soon as the second place winner is out from the ratings, the participants' rating sequence will equal \[5, 4, 1, 2\]. By this sequence you can count the new sequence of rating changes: \[0, -8, 2, 6\]. According to the problem statement, the application of the participant who won the second place will be considered. Initially this participant won third place.
3. The new rating sequence equals \[5, 1, 2\], the new sequence of rating changes equals \[0, -1, 1\]. The second place participant's application is taken into consideration, initially this participant won the fourth place.
4. The new rating sequence equals \[5, 2\], the new sequence of rating changes equals \[0, 0\]. No more applications will be considered.
Thus, you should print 2, 3, 4.
1. Initially the sequence of the contest participants' ratings equals \[5, 3, 4, 1, 2\]. You can use this sequence to calculate the sequence of rating changes: \[0, -9, -13, 8, 14\]. According to the problem statement, the application of the participant who won the second place will be considered first.
2. As soon as the second place winner is out from the ratings, the participants' rating sequence will equal \[5, 4, 1, 2\]. By this sequence you can count the new sequence of rating changes: \[0, -8, 2, 6\]. According to the problem statement, the application of the participant who won the second place will be considered. Initially this participant won third place.
3. The new rating sequence equals \[5, 1, 2\], the new sequence of rating changes equals \[0, -1, 1\]. The second place participant's application is taken into consideration, initially this participant won the fourth place.
4. The new rating sequence equals \[5, 2\], the new sequence of rating changes equals \[0, 0\]. No more applications will be considered.
Thus, you should print 2, 3, 4.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted