P2062 Team Division Problem
Description
Given $n$ players, partition them into several teams. The $i$-th player requires that the size of their team be at least $a_i$.
Subject to satisfying all players' requirements, maximize the total number of teams.
Note: Each player belongs to exactly one team.
Input Format
The first line contains an integer $n$, the number of people.
The next $n$ lines each contain an integer $a_i$.
Output Format
Output the maximum possible number of teams. It is guaranteed that a solution exists.
Explanation/Hint
- For 20% of the testdata, $n \leq 10$.
- For 40% of the testdata, $n \leq 1000$.
- For 60% of the testdata, $n \leq 10000$.
- For 100% of the testdata, $1 \leq n \leq 10^6$.
Translated by ChatGPT 5