IBMOA #22
Find Max Distinct Items
估计中等可在线判题
A store sells items numbered 1 to n, and item i costs i. You already own the items in arr; find the total number of distinct items you own after buying within budget k. Items you already own count even if they are outside the store's range, and duplicate numbers count only once.
输入格式
The first line contains n m k, and the second line contains the m numbers of owned items. 1≤n≤10^6, 1≤m≤10^5, 1≤k≤10^9, 1≤arr[i]≤10^6.
输出格式
Output one integer, the answer.
样例 1
输入:
5 2 8
3 6
输出:
5
样例 2
输入:
3 2 2
1 1
输出:
2
样例 3
输入:
2 1 1
6
输出:
2
样例说明
The examples give 5, 2 and 2 respectively. In the first example the owned item 6 still counts, and 1, 2 and 4 are newly bought.