#include<bits/stdc++.h>
using namespace std;
#define size second
#define value first
int N, M;
pair<int,int> picture[100100];
int frame[100100];
int ans;
int main() {
cin >> N >> M;
for(int i=1; i<=N; i++) {
cin >> picture[i].size >> picture[i].value;
}
sort(picture+1, picture+N+1);
for(int i=1; i<=M; i++) {
cin >> frame[i];
}
sort(frame+1, frame+M+1);
int i=N;
int j=M;
while(i>=1 && j>=1) {
if (picture[i].size <= frame[j]) {
ans++;
i--;
j--;
} else {
i--;
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
300 KB |
Output is correct |
18 |
Correct |
1 ms |
304 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
300 KB |
Output is correct |
18 |
Correct |
1 ms |
304 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
320 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
320 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
320 KB |
Output is correct |
31 |
Correct |
1 ms |
320 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
324 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
300 KB |
Output is correct |
18 |
Correct |
1 ms |
304 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
320 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
320 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
320 KB |
Output is correct |
31 |
Correct |
1 ms |
320 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
324 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
2 ms |
340 KB |
Output is correct |
38 |
Correct |
98 ms |
2636 KB |
Output is correct |
39 |
Correct |
98 ms |
2636 KB |
Output is correct |
40 |
Correct |
93 ms |
2636 KB |
Output is correct |
41 |
Correct |
98 ms |
2728 KB |
Output is correct |
42 |
Correct |
98 ms |
2724 KB |
Output is correct |
43 |
Correct |
104 ms |
2672 KB |
Output is correct |
44 |
Correct |
98 ms |
2660 KB |
Output is correct |
45 |
Correct |
96 ms |
2620 KB |
Output is correct |
46 |
Correct |
102 ms |
2644 KB |
Output is correct |
47 |
Correct |
89 ms |
2616 KB |
Output is correct |
48 |
Correct |
86 ms |
2516 KB |
Output is correct |
49 |
Correct |
79 ms |
2280 KB |
Output is correct |
50 |
Correct |
77 ms |
2324 KB |
Output is correct |
51 |
Correct |
106 ms |
2692 KB |
Output is correct |
52 |
Correct |
106 ms |
2788 KB |
Output is correct |
53 |
Correct |
96 ms |
2704 KB |
Output is correct |
54 |
Correct |
93 ms |
2676 KB |
Output is correct |
55 |
Correct |
104 ms |
2732 KB |
Output is correct |
56 |
Correct |
63 ms |
1740 KB |
Output is correct |
57 |
Correct |
35 ms |
1044 KB |
Output is correct |
58 |
Correct |
62 ms |
1784 KB |
Output is correct |
59 |
Correct |
83 ms |
1828 KB |
Output is correct |
60 |
Correct |
35 ms |
852 KB |
Output is correct |
61 |
Correct |
58 ms |
1512 KB |
Output is correct |
62 |
Correct |
101 ms |
2700 KB |
Output is correct |
63 |
Correct |
99 ms |
2712 KB |
Output is correct |
64 |
Correct |
99 ms |
2688 KB |
Output is correct |
65 |
Correct |
101 ms |
2608 KB |
Output is correct |
66 |
Correct |
106 ms |
2760 KB |
Output is correct |
67 |
Correct |
109 ms |
2620 KB |
Output is correct |
68 |
Correct |
99 ms |
2724 KB |
Output is correct |
69 |
Correct |
112 ms |
2684 KB |
Output is correct |
70 |
Correct |
107 ms |
2672 KB |
Output is correct |
71 |
Correct |
101 ms |
2696 KB |
Output is correct |
72 |
Correct |
99 ms |
2612 KB |
Output is correct |
73 |
Correct |
112 ms |
2756 KB |
Output is correct |