#P9460. 「EZEC-14」众数 I
「EZEC-14」众数 I
Description
Given a sequence of length , we construct a sequence in the following way:
- Initially, .
- Then perform operations on in order. In each operation, choose any one element and modify it to any integer.
dXqwq defines the mode of a sequence as all numbers with the highest frequency. For example, the mode of is , while the mode of is .
You need to find how many integers can possibly become the mode of .
Input Format
The first line contains two integers .
The second line contains integers .
Output Format
Output one integer, representing the number of values that can possibly become the mode.
In particular, if the answer is positive infinity, output pigstd.
5 0
1 2 3 4 5
5
5 1
1 2 3 4 5
pigstd
5 1
1 1 2 2 3
3
Hint
[Sample Explanation]
For the first group of testdata, in the end can be the mode of the interval.
For the second group of testdata, after changing the first number to , all of them will become the mode of the interval, so the answer is positive infinity.
For the third group of testdata, can become the mode of the interval.
[Hint]
Allocating std::deque may not necessarily cause MLE when the memory limit is 1024MB.
[Constraints]
This problem uses bundled testcases.
- Subtask 1 (20 pts): .
- Subtask 2 (20 pts): .
- Subtask 3 (20 pts): .
- Subtask 4 (20 pts): .
- Subtask 5 (20 pts): no special constraints.
For all data, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号