QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 256 MB 总分: 100

#15661. Cafebazaar's Applications

统计

年底了,Cafebazaar 发布了一个列表,其中包含其 $n$ 个应用中每个应用的用户数量。现在,每个应用都渴望通过一张广告图片来展示自己的成功,该图片会突出显示应用列表的一个连续子集,且该子集必须包含该应用本身。此外,为了使图片具有可信度,它必须包含至少 $k$ 个应用(包括其自身)。

对于列表中的每个应用,我们需要确定该应用在任何有效子集中,根据用户数量所能达到的最小可能排名。一个应用在子集中的排名定义为:该子集中用户数比它多的应用数量加一。

输入格式

输入的第一行包含两个整数 $n$ 和 $k$ ($1 \le k \le n \le 10^5$),其中 $n$ 表示应用的总数,$k$ 表示广告图片中应用的最少数量。

接下来的 $n$ 行包含每个应用的信息:第 $i$ 行包含 $c_i$,表示第 $i$ 个应用的用户数量 ($1 \le c_i \le 10^8$)。

输出格式

在输出的唯一一行中,打印 $n$ 个空格分隔的整数。第 $i$ 个整数应该是第 $i$ 个应用在广告图片中能达到的最小排名。

样例

输入样例 1

7 3
15000000
10000000
30000000
20000000
200000
70000000
100000000

输出样例 1

2 3 1 2 3 1 1

输入样例 2

3 2
10
10
10

输出样例 2

1 1 1

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.