#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
vector<array<int,2>>v(n);
vector<int>c(m);
for(int i=0;i<n;i++)cin>>v[i][1]>>v[i][0];
for(int i=0;i<m;i++)cin>>c[i];
sort(c.begin(),c.end());
for(int i=0;i<n;i++){
int cnt = 0;
//v[i][1] = m - (lower_bound(c.begin(),c.end(),v[i][1]) - c.begin());
for(int x:c)if(x >= v[i][1])cnt++;
v[i][1] = -cnt;
}
sort(v.begin(),v.end());
int ans = 0;
for(int i=n-1;i>=0;i--){
if(ans+1 <= -v[i][1])ans++;
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
2 ms |
236 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
272 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
272 KB |
Output is correct |
17 |
Correct |
1 ms |
272 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
2 ms |
236 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
272 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
272 KB |
Output is correct |
17 |
Correct |
1 ms |
272 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
272 KB |
Output is correct |
20 |
Correct |
4 ms |
320 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
284 KB |
Output is correct |
23 |
Correct |
3 ms |
284 KB |
Output is correct |
24 |
Correct |
2 ms |
332 KB |
Output is correct |
25 |
Correct |
3 ms |
296 KB |
Output is correct |
26 |
Correct |
4 ms |
332 KB |
Output is correct |
27 |
Correct |
3 ms |
280 KB |
Output is correct |
28 |
Correct |
4 ms |
332 KB |
Output is correct |
29 |
Correct |
4 ms |
332 KB |
Output is correct |
30 |
Correct |
3 ms |
332 KB |
Output is correct |
31 |
Correct |
3 ms |
332 KB |
Output is correct |
32 |
Correct |
2 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
2 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
296 KB |
Output is correct |
36 |
Correct |
4 ms |
332 KB |
Output is correct |
37 |
Correct |
3 ms |
300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
2 ms |
236 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
272 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
272 KB |
Output is correct |
17 |
Correct |
1 ms |
272 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
272 KB |
Output is correct |
20 |
Correct |
4 ms |
320 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
284 KB |
Output is correct |
23 |
Correct |
3 ms |
284 KB |
Output is correct |
24 |
Correct |
2 ms |
332 KB |
Output is correct |
25 |
Correct |
3 ms |
296 KB |
Output is correct |
26 |
Correct |
4 ms |
332 KB |
Output is correct |
27 |
Correct |
3 ms |
280 KB |
Output is correct |
28 |
Correct |
4 ms |
332 KB |
Output is correct |
29 |
Correct |
4 ms |
332 KB |
Output is correct |
30 |
Correct |
3 ms |
332 KB |
Output is correct |
31 |
Correct |
3 ms |
332 KB |
Output is correct |
32 |
Correct |
2 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
2 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
296 KB |
Output is correct |
36 |
Correct |
4 ms |
332 KB |
Output is correct |
37 |
Correct |
3 ms |
300 KB |
Output is correct |
38 |
Execution timed out |
1049 ms |
4268 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |