CF83B.Doctor

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

有 nn 只动物排成一队,等待多立特医生(Dr. Dolittle)的诊治。当一只动物进入诊室后,医生会为其检查、开具处方、安排检验,并可能安排额外检查。多立特医生对森林里的所有动物都非常熟悉,因此他确切地知道:队列中第 ii 只动物总共需要恰好就诊 aia_i 次。我们假设一次就诊所花费的时间远多于进行检验及其他额外程序所需时间;因此,我们假定:一旦某只动物离开诊室,它会立即重新排到队列末尾,再次等待就诊。当然,若某只动物已完成全部 aia_i 次就诊,则它无需再排到队列末尾,而是直接回家。

医生计划在接待完 kk 只动物后就下班回家,因此他很关心此时队列的状态。但由于医生工作时间很长,且终究无法在这种事情上分心,于是她请你来帮忙计算这一状态。

输入格式

The first line of input data contains two space-separated integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 1014). In the second line are given space-separated integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 109).

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).

输入数据的第一行包含两个以空格分隔的整数 nn 和 kk(1≤n≤1051 \leq n \leq 10^5,0≤k≤10140 \leq k \leq 10^{14})。第二行给出 nn 个以空格分隔的整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n(1≤ai≤1091 \leq a_i \leq 10^9)。

在 C++ 中,请勿使用 %lld 格式说明符读取或写入 64 位整数。推荐使用 cin 和 cout 流(也可使用 %I64d 格式说明符)。

输出格式

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.

如果医生总共进行的检查次数少于 k 次,则输出单个数字 “-1”(不带引号)。否则,输出一个数字序列——即队列中动物的数量(按它们在队列中所站的顺序)。

注意:该序列可能为空。这种情况出现在预测试中。您可以直接不输出任何内容,或仅输出一个换行符(“End of line”字符)。两种方式均会被接受。

输入输出样例

  • 输入#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}

在第一个样例测试中:

  • 检查前:{1, 2, 3}
  • 第一次检查后:{2, 3}
  • 第二次检查后:{3, 2}
  • 第三次检查后:{2}

在第二个样例测试中:

  • 检查前:{1, 2, 3, 4, 5, 6, 7}
  • 第一次检查后:{2, 3, 4, 5, 6, 7}
  • 第二次检查后:{3, 4, 5, 6, 7, 2}
  • 第三次检查后:{4, 5, 6, 7, 2, 3}
  • 第四次检查后:{5, 6, 7, 2, 3}
  • 第五次检查后:{6, 7, 2, 3, 5}
  • 第六次检查后:{7, 2, 3, 5, 6}
  • 第七次检查后:{2, 3, 5, 6}
  • 第八次检查后:{3, 5, 6, 2}
  • 第九次检查后:{5, 6, 2, 3}
  • 第十次检查后:{6, 2, 3}

输入解题思路,AI测评打分。不知道怎么写?

首页