A8091 | Doctor
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
There are $n$ animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows exactly that the animal number $i$ in the queue will have to visit his office exactly $a_{i}$ times. We will assume that an examination takes much more time than making tests and other extra procedures, and therefore we will assume that once an animal leaves the room, it immediately gets to the end of the queue to the doctor. Of course, if the animal has visited the doctor as many times as necessary, then it doesn't have to stand at the end of the queue and it immediately goes home.
Doctor plans to go home after receiving $k$ animals, and therefore what the queue will look like at that moment is important for him. Since the doctor works long hours and she can't get distracted like that after all, she asked you to figure it out.
Doctor plans to go home after receiving $k$ animals, and therefore what the queue will look like at that moment is important for him. Since the doctor works long hours and she can't get distracted like that after all, she asked you to figure it out.
输入格式
The first line of input data contains two space-separated integers $n$ and $k$ ( $1<=n<=10^{5}$ , $0<=k<=10^{14}$ ). In the second line are given space-separated integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{i}<=10^{9}$ ).
Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is recommended to use cin, cout streams (you can also use the %I64d specificator).
Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is recommended to use cin, cout streams (you can also use the %I64d specificator).
输出格式
If the doctor will overall carry out less than $k$ examinations, print a single number "-1" (without quotes). Otherwise, print the sequence of numbers — number of animals in the order in which they stand in the queue.
Note that this sequence may be empty. This case is present in pretests. You can just print nothing or print one "End of line"-character. Both will be accepted.
Note that this sequence may be empty. This case is present in pretests. You can just print nothing or print one "End of line"-character. Both will be accepted.
输入输出样例
输入 #1
3 3 1 2 1
输出 #1
2
输入 #2
4 10 3 3 2 1
输出 #2
-1
输入 #3
7 10 1 3 3 1 2 3 1
输出 #3
6 2 3
In the first sample test:
- Before examination: ${1,2,3}$
- After the first examination: ${2,3}$
- After the second examination: ${3,2}$
- After the third examination: ${2}$
In the second sample test:
- Before examination: ${1,2,3,4,5,6,7}$
- After the first examination: ${2,3,4,5,6,7}$
- After the second examination: ${3,4,5,6,7,2}$
- After the third examination: ${4,5,6,7,2,3}$
- After the fourth examination: ${5,6,7,2,3}$
- After the fifth examination: ${6,7,2,3,5}$
- After the sixth examination: ${7,2,3,5,6}$
- After the seventh examination: ${2,3,5,6}$
- After the eighth examination: ${3,5,6,2}$
- After the ninth examination: ${5,6,2,3}$
- After the tenth examination: ${6,2,3}$
- Before examination: ${1,2,3}$
- After the first examination: ${2,3}$
- After the second examination: ${3,2}$
- After the third examination: ${2}$
In the second sample test:
- Before examination: ${1,2,3,4,5,6,7}$
- After the first examination: ${2,3,4,5,6,7}$
- After the second examination: ${3,4,5,6,7,2}$
- After the third examination: ${4,5,6,7,2,3}$
- After the fourth examination: ${5,6,7,2,3}$
- After the fifth examination: ${6,7,2,3,5}$
- After the sixth examination: ${7,2,3,5,6}$
- After the seventh examination: ${2,3,5,6}$
- After the eighth examination: ${3,5,6,2}$
- After the ninth examination: ${5,6,2,3}$
- After the tenth examination: ${6,2,3}$
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted