#P11273. 「Diligent-OI R1 C」DlgtRank
「Diligent-OI R1 C」DlgtRank
Problem Description
You are given a sequence of length . Here, the rank of is defined as the number of elements in that are strictly greater than , plus .
Now there are some operations to modify the elements in . Before all operations, you are given a constant in advance. Before each operation, is defined to be movable if and only if, after only adding to while keeping all other values unchanged, the rank of does not change. Otherwise, is not movable in this operation. Then this operation is: add to all movable numbers in the sequence.
It can be proven that after a certain number of operations, all values in will become movable, and once this state is reached for the first time, all subsequent operations will also stay in this state. In other words, no matter how many operations you perform, the number of times each value in is in the not movable state is finite.
Now you are asked: after performing this operation sufficiently many times, how many times is each value in in the not movable state.
Input Format
The first line contains two integers .
The next line contains integers , representing the initial sequence .
Output Format
Output one line with integers. The -th integer indicates how many times is in the not movable state during the operations.
3 1
1 3 4
1 1 0
6 2
1 2 5 6 7 8
4 3 3 2 1 0
8 10
1 14 5 14 19 19 8 10
5 1 4 1 0 0 3 2
Hint
Sample #1 Explanation
Initially, .
After one operation, . is not movable because if we only add to , its rank would change from to .
After two operations, . is not movable because if we only add to , its rank would change from to .
After three operations, . In this operation, all values are movable. It can be proven that no matter how many more operations you perform, the not movable state will never appear again.
Therefore, during the process, is not movable once, is not movable once, and is never not movable.
Constraints and Notes
For of the testdata, , .
| Subtask ID | Special Property | Score | |
|---|---|---|---|
| ABC | |||
| C | |||
| None | |||
| C | |||
| None | |||
| A | |||
| BC | |||
| C | |||
| None |
Special property A: all are equal.
Special property B: for any , .
Special property C: for any , .
Translated by ChatGPT 5