#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
multiset <pair <int, int>> q;
int frame[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n, m;
cin >> n >> m;
for(int i=1; i<=n; i++){
int a, b;
cin >> a >> b;
q.insert({-b, -a});
}
for(int i=1; i<=m; i++){
cin >> frame[i];
}
sort(frame+1, frame+1+m);
int res = 0;
for(int i=m; i>=1; i--){
while(!q.empty()){
pair <int, int> par = *q.begin();
q.erase(q.begin());
if(-par.second > frame[i]) continue;
res++;
break;
}
}
cout << res;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
460 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
1 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
1 ms |
332 KB |
Output is correct |
35 |
Correct |
1 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
460 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
1 ms |
332 KB |
Output is correct |
24 |
Correct |
1 ms |
332 KB |
Output is correct |
25 |
Correct |
1 ms |
332 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
1 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
1 ms |
332 KB |
Output is correct |
35 |
Correct |
1 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
38 |
Correct |
83 ms |
8192 KB |
Output is correct |
39 |
Correct |
104 ms |
8284 KB |
Output is correct |
40 |
Correct |
83 ms |
8192 KB |
Output is correct |
41 |
Correct |
87 ms |
8260 KB |
Output is correct |
42 |
Correct |
90 ms |
8176 KB |
Output is correct |
43 |
Correct |
92 ms |
8268 KB |
Output is correct |
44 |
Correct |
85 ms |
8260 KB |
Output is correct |
45 |
Correct |
85 ms |
8256 KB |
Output is correct |
46 |
Correct |
104 ms |
8164 KB |
Output is correct |
47 |
Correct |
92 ms |
7852 KB |
Output is correct |
48 |
Correct |
76 ms |
7852 KB |
Output is correct |
49 |
Correct |
63 ms |
6384 KB |
Output is correct |
50 |
Correct |
64 ms |
6276 KB |
Output is correct |
51 |
Correct |
86 ms |
8252 KB |
Output is correct |
52 |
Correct |
92 ms |
8244 KB |
Output is correct |
53 |
Correct |
100 ms |
8236 KB |
Output is correct |
54 |
Correct |
76 ms |
8212 KB |
Output is correct |
55 |
Correct |
84 ms |
8232 KB |
Output is correct |
56 |
Correct |
67 ms |
6852 KB |
Output is correct |
57 |
Correct |
24 ms |
1628 KB |
Output is correct |
58 |
Correct |
77 ms |
7000 KB |
Output is correct |
59 |
Correct |
83 ms |
6980 KB |
Output is correct |
60 |
Correct |
21 ms |
1612 KB |
Output is correct |
61 |
Correct |
47 ms |
3876 KB |
Output is correct |
62 |
Correct |
87 ms |
8252 KB |
Output is correct |
63 |
Correct |
85 ms |
8204 KB |
Output is correct |
64 |
Correct |
82 ms |
8260 KB |
Output is correct |
65 |
Correct |
89 ms |
8256 KB |
Output is correct |
66 |
Correct |
110 ms |
8208 KB |
Output is correct |
67 |
Correct |
83 ms |
8176 KB |
Output is correct |
68 |
Correct |
82 ms |
8244 KB |
Output is correct |
69 |
Correct |
90 ms |
8300 KB |
Output is correct |
70 |
Correct |
83 ms |
8184 KB |
Output is correct |
71 |
Correct |
102 ms |
8176 KB |
Output is correct |
72 |
Correct |
115 ms |
8212 KB |
Output is correct |
73 |
Correct |
80 ms |
8216 KB |
Output is correct |