#P9812. [CCC 2015 S3] Gates
[CCC 2015 S3] Gates
Problem Description
An airport has gates. You need to assign planes in order. The -th plane can only use gates . Each gate can be used by at most one plane permanently. When there is no gate available for some plane, the airport will close, and the planes after that cannot dock.
Please determine a plan that maximizes the number of planes that can be assigned a gate.
Input Format
The first line contains an integer .
The second line contains an integer .
The next lines each contain an integer .
Output Format
Output one integer on a single line, representing the maximum number of planes that can be assigned.
4
3
4
1
1
2
4
6
2
2
3
3
4
4
3
Hint
Constraints:
For of the testdata, .
For of the testdata, , and .
In this problem, Subtask 0 uses the original problem testdata, and Subtask 1 uses Hack testdata. Hack testdata is not scored.
Translated by ChatGPT 5