G. [ICPC 2023 Tehran R] Cafebazaar' s Applications

    远端评测题 1000ms 1024MiB

[ICPC 2023 Tehran R] Cafebazaar' s Applications

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

It's the end of the year, and Cafebazaar has released a list, containing the number of users of each of its nn applications. Now, each application is eager to showcase its success through an advertisement image, which highlights a continuous subset of the application list containing the application itself. Also, for the image to be credible, it should contain at least kk applications, including itself.

For each application in this list, we need to determine the minimum possible rank this application can achieve within any valid subset, according to the number of users. The rank of an application within a subset is defined by the number of applications in that subset that have more users than it, plus one.

:::align{center} :::

Input Format

The first line of input consists of two integers nn and kk (1kn1051 \leq k \leq n \leq 10^5), where nn represents the total number of applications and kk represents the minimum number of applications in an advertisement image. The following nn lines contain information about each application: the ithi^{th} line contains cic_i, representing the number of users for the ithi^{th} application (1ci1081 \leq c_i \leq 10^8).

Output Format

In the only line of output print nn space-separated integers. The ithi^{th} integer should be the minimum rank that ithi^{th} application can achieve within an advertisement image.

7 3
15000000
10000000
30000000
20000000
200000
70000000
100000000
2 3 1 2 3 1 1
3 2
10
10
10
1 1 1

ICPC欢乐赛

未参加
状态
已结束
规则
XCPC
题目
8
开始于
2026-2-7 8:30
结束于
2026-2-7 12:30
持续时间
4 小时
主持人
参赛人数
22