QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100

#3284. 体检

統計

大学的学生们需要进行体检,体检包含许多项目,编号依次为 $1, 2, 3, \dots$。

学生们排成一队长队,等待体检开始。学生们也按队列顺序编号为 $1, 2, 3, \dots$。他们必须按照项目编号的顺序进行体检,不能跳过任何项目,也不能改变顺序。学生的顺序也不能改变。

多个体检项目可以并行进行,但每个项目同一时间只能供一名学生使用。如果某位学生需要进行的下一项体检正在被他人占用,该学生必须在队列中等待,直到前面的学生完成。

每位学生都有一个称为“健康状况”的整数值。对于健康状况为 $h$ 的学生,完成每一项体检都需要 $h$ 分钟。你可以假设在同一体检项目的两名学生之间,或同一名学生的两个体检项目之间,不需要任何间隔时间。

你的任务是找出在指定时间 $t$ 时,每位学生正在进行或正在等待的体检项目编号。

输入格式

输入包含一组测试数据,格式如下:

$n \ t$ $h_1$ $\vdots$ $h_n$

$n$ 和 $t$ 为整数。$n$ 是学生人数 ($1 \le n \le 10^5$),$t$ 是我们关注的时间点 ($0 \le t \le 10^9$)。对于每位学生 $i$,整数 $h_i$ 是其健康状况 ($1 \le h_i \le 10^9$)。

输出格式

输出 $n$ 行,每行包含一个整数。第 $i$ 行应包含学生 $i$ 在体检开始后 $(t + 0.5)$ 分钟时正在进行或正在等待的体检项目编号。你可以假设在那个时刻,所有学生都尚未完成所有体检项目。

样例

样例输入 1

3 20
5
7
3

样例输出 1

5
3
2

样例输入 2

5 1000000000
5553
2186
3472
2605
1790

样例输出 2

180083
180083
180082
180082
180082

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.