-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path1355B_Young_Explorers.cpp
More file actions
53 lines (42 loc) · 923 Bytes
/
1355B_Young_Explorers.cpp
File metadata and controls
53 lines (42 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <vector>
#define DEBUG
#define MAXN 10000000
#define ll long long int
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef DEBUG
freopen("in.in", "r", stdin);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int > v(n+1, 0);
for (int i = 0; i < n; ++i) {
int t;
cin >> t;
++v[t];
}
int ans = 0;
for (int i = 1; i < n+1; ++i) {
ans += (v[i] / i) ;
v[i] %= i;
}
int temp = 0;
for (int i = 1; i < n+1; ++i) {
if (v[i]) {
temp += v[i];
if (temp / i) {
ans += (temp / i);
temp %= i;
}
}
}
cout << ans << endl;
}
return 0;
}