#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
vector<pair<long long, long long> > pic;
vector<long long> frame;
signed main(){
long long n,m;
cin >> n >> m;
for(int i=1;i<=n;i++){
long long s,v;
cin >> s >> v;
pic.push_back({v,s});
}
for(int i=1;i<=m;i++){
long long a;
cin >> a;
frame.push_back(a);
}
sort(pic.begin(),pic.end());
sort(frame.begin(),frame.end());
long long ans=m-1;
for(int i=n-1;i>=0;i--){
if(pic[i].se<=frame[ans]){
//cout << pic[i].se << " " << frame[ans]<<endl;
ans--;
}
if(ans<0){
break;
}
}
cout << (m-ans-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
296 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
424 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
296 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
424 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
4 ms |
376 KB |
Output is correct |
21 |
Correct |
4 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
4 ms |
376 KB |
Output is correct |
24 |
Correct |
4 ms |
376 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
4 ms |
376 KB |
Output is correct |
27 |
Correct |
4 ms |
376 KB |
Output is correct |
28 |
Correct |
4 ms |
376 KB |
Output is correct |
29 |
Correct |
4 ms |
376 KB |
Output is correct |
30 |
Correct |
4 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
376 KB |
Output is correct |
32 |
Correct |
3 ms |
376 KB |
Output is correct |
33 |
Correct |
3 ms |
376 KB |
Output is correct |
34 |
Correct |
4 ms |
376 KB |
Output is correct |
35 |
Correct |
3 ms |
376 KB |
Output is correct |
36 |
Correct |
5 ms |
376 KB |
Output is correct |
37 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
296 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
424 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
4 ms |
376 KB |
Output is correct |
21 |
Correct |
4 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
4 ms |
376 KB |
Output is correct |
24 |
Correct |
4 ms |
376 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
4 ms |
376 KB |
Output is correct |
27 |
Correct |
4 ms |
376 KB |
Output is correct |
28 |
Correct |
4 ms |
376 KB |
Output is correct |
29 |
Correct |
4 ms |
376 KB |
Output is correct |
30 |
Correct |
4 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
376 KB |
Output is correct |
32 |
Correct |
3 ms |
376 KB |
Output is correct |
33 |
Correct |
3 ms |
376 KB |
Output is correct |
34 |
Correct |
4 ms |
376 KB |
Output is correct |
35 |
Correct |
3 ms |
376 KB |
Output is correct |
36 |
Correct |
5 ms |
376 KB |
Output is correct |
37 |
Correct |
6 ms |
376 KB |
Output is correct |
38 |
Correct |
251 ms |
3852 KB |
Output is correct |
39 |
Correct |
239 ms |
3684 KB |
Output is correct |
40 |
Correct |
235 ms |
3880 KB |
Output is correct |
41 |
Correct |
244 ms |
3784 KB |
Output is correct |
42 |
Correct |
276 ms |
3836 KB |
Output is correct |
43 |
Correct |
245 ms |
3760 KB |
Output is correct |
44 |
Correct |
241 ms |
3812 KB |
Output is correct |
45 |
Correct |
240 ms |
3696 KB |
Output is correct |
46 |
Correct |
239 ms |
3740 KB |
Output is correct |
47 |
Correct |
217 ms |
3556 KB |
Output is correct |
48 |
Correct |
215 ms |
3648 KB |
Output is correct |
49 |
Correct |
192 ms |
3300 KB |
Output is correct |
50 |
Correct |
192 ms |
3396 KB |
Output is correct |
51 |
Correct |
240 ms |
3660 KB |
Output is correct |
52 |
Correct |
240 ms |
3848 KB |
Output is correct |
53 |
Correct |
238 ms |
3832 KB |
Output is correct |
54 |
Correct |
235 ms |
3724 KB |
Output is correct |
55 |
Correct |
242 ms |
3784 KB |
Output is correct |
56 |
Correct |
158 ms |
2564 KB |
Output is correct |
57 |
Correct |
84 ms |
1524 KB |
Output is correct |
58 |
Correct |
158 ms |
2540 KB |
Output is correct |
59 |
Correct |
159 ms |
2628 KB |
Output is correct |
60 |
Correct |
84 ms |
1520 KB |
Output is correct |
61 |
Correct |
139 ms |
2540 KB |
Output is correct |
62 |
Correct |
240 ms |
3824 KB |
Output is correct |
63 |
Correct |
294 ms |
3660 KB |
Output is correct |
64 |
Correct |
257 ms |
3808 KB |
Output is correct |
65 |
Correct |
241 ms |
3684 KB |
Output is correct |
66 |
Correct |
245 ms |
3752 KB |
Output is correct |
67 |
Correct |
240 ms |
3776 KB |
Output is correct |
68 |
Correct |
242 ms |
3840 KB |
Output is correct |
69 |
Correct |
241 ms |
3812 KB |
Output is correct |
70 |
Correct |
242 ms |
3680 KB |
Output is correct |
71 |
Correct |
240 ms |
3792 KB |
Output is correct |
72 |
Correct |
246 ms |
3684 KB |
Output is correct |
73 |
Correct |
239 ms |
3784 KB |
Output is correct |