#include <iostream>
#include <queue>
#include <algorithm>
#define int long long
using namespace std;
const int MAX_TABLEAU = 1e5+42;
int nbTableau, nbCadre;
pair<int, int> tableau[MAX_TABLEAU];
int cadre[MAX_TABLEAU];
priority_queue<pair<int, int>> q;
void input() {
cin >> nbTableau >> nbCadre;
for(int i = 0; i < nbTableau; i++) {
cin >> tableau[i].first >> tableau[i].second;
q.push({tableau[i].second, tableau[i].first});
}
sort(tableau, tableau + nbTableau);
for(int i = 0; i < nbCadre; i++) {
cin >> cadre[i];
}
sort(cadre, cadre + nbCadre);
}
int total = 0;
signed main() {
input();
for(int curCadre = nbCadre-1; curCadre >= 0; curCadre--) {
while(q.size() > 0 && q.top().second > cadre[curCadre]) {
q.pop();
}
if(q.size() == 0) {
break;
}
total++;
q.pop();
}
cout << total;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
300 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 |
308 KB |
Output is correct |
11 |
Correct |
1 ms |
308 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 |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
300 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 |
308 KB |
Output is correct |
11 |
Correct |
1 ms |
308 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 |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
316 KB |
Output is correct |
22 |
Correct |
2 ms |
324 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
3 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
316 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
316 KB |
Output is correct |
36 |
Correct |
2 ms |
320 KB |
Output is correct |
37 |
Correct |
2 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
300 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 |
308 KB |
Output is correct |
11 |
Correct |
1 ms |
308 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 |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
316 KB |
Output is correct |
22 |
Correct |
2 ms |
324 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
3 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
316 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
316 KB |
Output is correct |
36 |
Correct |
2 ms |
320 KB |
Output is correct |
37 |
Correct |
2 ms |
320 KB |
Output is correct |
38 |
Correct |
145 ms |
7112 KB |
Output is correct |
39 |
Correct |
141 ms |
7116 KB |
Output is correct |
40 |
Correct |
139 ms |
7192 KB |
Output is correct |
41 |
Correct |
143 ms |
7196 KB |
Output is correct |
42 |
Correct |
161 ms |
7224 KB |
Output is correct |
43 |
Correct |
139 ms |
7212 KB |
Output is correct |
44 |
Correct |
136 ms |
7184 KB |
Output is correct |
45 |
Correct |
144 ms |
7156 KB |
Output is correct |
46 |
Correct |
140 ms |
7160 KB |
Output is correct |
47 |
Correct |
131 ms |
6640 KB |
Output is correct |
48 |
Correct |
138 ms |
6624 KB |
Output is correct |
49 |
Correct |
110 ms |
5612 KB |
Output is correct |
50 |
Correct |
118 ms |
5696 KB |
Output is correct |
51 |
Correct |
159 ms |
7208 KB |
Output is correct |
52 |
Correct |
152 ms |
7224 KB |
Output is correct |
53 |
Correct |
140 ms |
7068 KB |
Output is correct |
54 |
Correct |
133 ms |
7172 KB |
Output is correct |
55 |
Correct |
160 ms |
7188 KB |
Output is correct |
56 |
Correct |
89 ms |
5468 KB |
Output is correct |
57 |
Correct |
45 ms |
1968 KB |
Output is correct |
58 |
Correct |
86 ms |
5388 KB |
Output is correct |
59 |
Correct |
88 ms |
5484 KB |
Output is correct |
60 |
Correct |
47 ms |
2052 KB |
Output is correct |
61 |
Correct |
88 ms |
3892 KB |
Output is correct |
62 |
Correct |
150 ms |
7204 KB |
Output is correct |
63 |
Correct |
134 ms |
7200 KB |
Output is correct |
64 |
Correct |
137 ms |
7240 KB |
Output is correct |
65 |
Correct |
168 ms |
7132 KB |
Output is correct |
66 |
Correct |
147 ms |
7240 KB |
Output is correct |
67 |
Correct |
147 ms |
7112 KB |
Output is correct |
68 |
Correct |
169 ms |
7168 KB |
Output is correct |
69 |
Correct |
168 ms |
7136 KB |
Output is correct |
70 |
Correct |
139 ms |
7188 KB |
Output is correct |
71 |
Correct |
150 ms |
7232 KB |
Output is correct |
72 |
Correct |
185 ms |
7236 KB |
Output is correct |
73 |
Correct |
140 ms |
7224 KB |
Output is correct |