#abc306e. E - Best Performances
E - Best Performances
Score : points
问题描述
我们有一个长度为 的序列 。最初,所有项均为 。
给定一个整数 ,我们定义一个函数 如下:
- 首先,将序列 按降序排序得到序列 (使其单调非增)。
- 然后,令 。
我们考虑对这个序列应用 次更新操作。按照顺序对序列 应用以下操作,对于 ,并在每次更新后输出此时的 值。
- 将 改为 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a sequence of length . Initially, all the terms are .
Using an integer given in the input, we define a function as follows:
- Let be the sequence obtained by sorting in descending order (so that it becomes monotonically non-increasing).
- Then, let .
We consider applying updates on this sequence.
Apply the following operation on the sequence for in this order, and print the value at that point after each update.
- Change to .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines in total. The -th line should contain the value as an integer when the -th update has ended.
Sample Input 1
4 2 10
1 5
2 1
3 3
4 2
2 10
1 0
4 0
3 1
2 0
3 0
Sample Output 1
5
6
8
8
15
13
13
11
1
0
In this input, and . updates are applied.
- The -st update makes . Now, .
- The -nd update makes . Now, .
- The -rd update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
- The -th update makes . Now, .
update @ 2024/3/10 08:39:16