#include <bits/stdc++.h>
#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define int long long
using namespace std;
const int inf = (int)1e9 + 7 ;
const long long mod = 1e9 + 7;
const int N = (int)300007;
int n, m, c[N];
vector<pair<int,int >> v;
main(){
int a, b;
cin >> n >> m;
for(int i = 1;i <= n; i++){
cin >> a >> b;
v.pb(mk(b,a));
}
sort(all(v));
for(int i = 1;i <= m; i++){
cin >> c[i];
}
sort(c + 1, c + 1 + m);
/*for(int i = 0;i < n; i++){
cout << v[i].fr << " " << v[i].sc << endl;
}
for(int i = 1;i <= m; i++){
cout << c[i] << " ";
}*/
int ans = 0;
for(int i = n - 1;i >= 0 && ans < m; i--){
if(v[i].sc <= c[m - ans]){
ans++;
}
}
cout << ans;
}
Compilation message
joi2019_ho_t2.cpp:19:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 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 |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
384 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 |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 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 |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
384 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 |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
4 ms |
384 KB |
Output is correct |
23 |
Correct |
3 ms |
384 KB |
Output is correct |
24 |
Correct |
3 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
512 KB |
Output is correct |
26 |
Correct |
4 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
3 ms |
384 KB |
Output is correct |
30 |
Correct |
3 ms |
384 KB |
Output is correct |
31 |
Correct |
4 ms |
384 KB |
Output is correct |
32 |
Correct |
3 ms |
384 KB |
Output is correct |
33 |
Correct |
3 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
3 ms |
384 KB |
Output is correct |
36 |
Correct |
4 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 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 |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
384 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 |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
4 ms |
384 KB |
Output is correct |
23 |
Correct |
3 ms |
384 KB |
Output is correct |
24 |
Correct |
3 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
512 KB |
Output is correct |
26 |
Correct |
4 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
3 ms |
384 KB |
Output is correct |
30 |
Correct |
3 ms |
384 KB |
Output is correct |
31 |
Correct |
4 ms |
384 KB |
Output is correct |
32 |
Correct |
3 ms |
384 KB |
Output is correct |
33 |
Correct |
3 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
3 ms |
384 KB |
Output is correct |
36 |
Correct |
4 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
38 |
Correct |
154 ms |
5672 KB |
Output is correct |
39 |
Correct |
141 ms |
5732 KB |
Output is correct |
40 |
Correct |
178 ms |
5732 KB |
Output is correct |
41 |
Correct |
153 ms |
5728 KB |
Output is correct |
42 |
Correct |
144 ms |
5648 KB |
Output is correct |
43 |
Correct |
172 ms |
5712 KB |
Output is correct |
44 |
Correct |
207 ms |
5712 KB |
Output is correct |
45 |
Correct |
171 ms |
5604 KB |
Output is correct |
46 |
Correct |
154 ms |
5636 KB |
Output is correct |
47 |
Correct |
151 ms |
5128 KB |
Output is correct |
48 |
Correct |
163 ms |
5160 KB |
Output is correct |
49 |
Correct |
120 ms |
4680 KB |
Output is correct |
50 |
Correct |
129 ms |
4696 KB |
Output is correct |
51 |
Correct |
189 ms |
5636 KB |
Output is correct |
52 |
Correct |
152 ms |
5704 KB |
Output is correct |
53 |
Correct |
161 ms |
5732 KB |
Output is correct |
54 |
Correct |
200 ms |
5740 KB |
Output is correct |
55 |
Correct |
170 ms |
5832 KB |
Output is correct |
56 |
Correct |
104 ms |
4048 KB |
Output is correct |
57 |
Correct |
61 ms |
2168 KB |
Output is correct |
58 |
Correct |
111 ms |
3944 KB |
Output is correct |
59 |
Correct |
99 ms |
4072 KB |
Output is correct |
60 |
Correct |
59 ms |
2036 KB |
Output is correct |
61 |
Correct |
89 ms |
3436 KB |
Output is correct |
62 |
Correct |
154 ms |
5732 KB |
Output is correct |
63 |
Correct |
160 ms |
5732 KB |
Output is correct |
64 |
Correct |
155 ms |
5704 KB |
Output is correct |
65 |
Correct |
252 ms |
5668 KB |
Output is correct |
66 |
Correct |
211 ms |
5676 KB |
Output is correct |
67 |
Correct |
143 ms |
5732 KB |
Output is correct |
68 |
Correct |
143 ms |
5732 KB |
Output is correct |
69 |
Correct |
158 ms |
5780 KB |
Output is correct |
70 |
Correct |
164 ms |
5756 KB |
Output is correct |
71 |
Correct |
179 ms |
5756 KB |
Output is correct |
72 |
Correct |
191 ms |
5880 KB |
Output is correct |
73 |
Correct |
157 ms |
5732 KB |
Output is correct |