#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define bas(x) #x << ": " << x << " "
#define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl;
#define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl;
#define ppair(x) "(" << x.first << ", " << x.second << ")"
#define inside sl<=l&&r<=sr
#define outside sr<l||r<sl
typedef long long ll;
int n, m;
pair<int, int> pics[100005];
int frames[100005];
int main(){
//freopen("in", "r", stdin);
//freopen("out", "w", stdout);
cin >> n >> m;
for (int i = 0; i < n; i++){
cin >> pics[i].second >> pics[i].first;
}
for (int i = 0; i < m; i++) cin >> frames[i];
sort(frames, frames+m);
sort(pics, pics+n);
int ans = 0;
int i = n-1;
int j = m-1;
while (i >= 0 && j >= 0){
if (pics[i].second <= frames[j]){
ans++;
i--;
j--;
} else i--;
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 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 |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 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 |
376 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 |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 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 |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 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 |
376 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 |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
376 KB |
Output is correct |
21 |
Correct |
5 ms |
376 KB |
Output is correct |
22 |
Correct |
4 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 |
256 KB |
Output is correct |
34 |
Correct |
4 ms |
376 KB |
Output is correct |
35 |
Correct |
3 ms |
376 KB |
Output is correct |
36 |
Correct |
4 ms |
376 KB |
Output is correct |
37 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 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 |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 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 |
376 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 |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
376 KB |
Output is correct |
21 |
Correct |
5 ms |
376 KB |
Output is correct |
22 |
Correct |
4 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 |
256 KB |
Output is correct |
34 |
Correct |
4 ms |
376 KB |
Output is correct |
35 |
Correct |
3 ms |
376 KB |
Output is correct |
36 |
Correct |
4 ms |
376 KB |
Output is correct |
37 |
Correct |
4 ms |
376 KB |
Output is correct |
38 |
Correct |
236 ms |
1448 KB |
Output is correct |
39 |
Correct |
235 ms |
1532 KB |
Output is correct |
40 |
Correct |
232 ms |
1432 KB |
Output is correct |
41 |
Correct |
285 ms |
1464 KB |
Output is correct |
42 |
Correct |
235 ms |
1528 KB |
Output is correct |
43 |
Correct |
235 ms |
1508 KB |
Output is correct |
44 |
Correct |
236 ms |
1728 KB |
Output is correct |
45 |
Correct |
234 ms |
1656 KB |
Output is correct |
46 |
Correct |
237 ms |
1464 KB |
Output is correct |
47 |
Correct |
227 ms |
1400 KB |
Output is correct |
48 |
Correct |
212 ms |
1348 KB |
Output is correct |
49 |
Correct |
189 ms |
1256 KB |
Output is correct |
50 |
Correct |
188 ms |
1400 KB |
Output is correct |
51 |
Correct |
244 ms |
1528 KB |
Output is correct |
52 |
Correct |
236 ms |
1528 KB |
Output is correct |
53 |
Correct |
236 ms |
1504 KB |
Output is correct |
54 |
Correct |
234 ms |
1476 KB |
Output is correct |
55 |
Correct |
239 ms |
1596 KB |
Output is correct |
56 |
Correct |
158 ms |
1188 KB |
Output is correct |
57 |
Correct |
83 ms |
760 KB |
Output is correct |
58 |
Correct |
155 ms |
1032 KB |
Output is correct |
59 |
Correct |
157 ms |
1144 KB |
Output is correct |
60 |
Correct |
83 ms |
632 KB |
Output is correct |
61 |
Correct |
136 ms |
988 KB |
Output is correct |
62 |
Correct |
245 ms |
1484 KB |
Output is correct |
63 |
Correct |
250 ms |
1492 KB |
Output is correct |
64 |
Correct |
237 ms |
1528 KB |
Output is correct |
65 |
Correct |
236 ms |
1528 KB |
Output is correct |
66 |
Correct |
236 ms |
1556 KB |
Output is correct |
67 |
Correct |
236 ms |
1512 KB |
Output is correct |
68 |
Correct |
236 ms |
1524 KB |
Output is correct |
69 |
Correct |
237 ms |
1528 KB |
Output is correct |
70 |
Correct |
238 ms |
1528 KB |
Output is correct |
71 |
Correct |
250 ms |
1508 KB |
Output is correct |
72 |
Correct |
238 ms |
1536 KB |
Output is correct |
73 |
Correct |
234 ms |
1528 KB |
Output is correct |