/***
* _ _ _ _ _ _ _ _ _ _
* | |_ ___ (_) ___| |__ ___ __| | ___ (_) __ _(_) __ _ _ _ _ __ | |__ _ _| |_ ___ _ __ ___ _ _ ___ _ _| |_ ___ (_)
* | __/ _ \| |/ __| '_ \ / _ \ / _` |/ _ \| |/ _` | |/ _` | | | | '_ \| '_ \| | | | __/ _ \ '_ ` _ \| | | |/ _ \ | | | __/ _ \| |
* | || (_) | | (__| | | | (_) | (_| | (_) | | (_| | | (_| | |_| | |_) | | | | |_| | || __/ | | | | | |_| | __/ |_| | || (_) | |
* \__\___/|_|\___|_| |_|\___/ \__,_|\___/|_|\__, |_|\__,_|\__, | .__/|_| |_|\__,_|\__\___|_| |_| |_|\__, |\___|\__,_|\__\___/|_|
* |___/ |___/|_| |___/
*/
#include<bits/stdc++.h>
using namespace std;
vector<int>r;
vector<pair<int,int>>v1;
int main(){
int n,m,s,v,x;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>s>>v;
v1.push_back(make_pair(v,s));
}
for(int i=0;i<m;i++){
cin>>x;
r.push_back(x);
}
sort(v1.begin(),v1.end());
sort(r.begin(),r.end());
int ans=m-1;
for(int i=n-1;i>=0;i--){
if(v1[i].second<=r[ans]) ans--;
if(ans<0) break;
}
cout<<m-ans-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
128 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
128 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 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 |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
4 ms |
256 KB |
Output is correct |
24 |
Correct |
4 ms |
376 KB |
Output is correct |
25 |
Correct |
4 ms |
252 KB |
Output is correct |
26 |
Correct |
4 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
256 KB |
Output is correct |
28 |
Correct |
5 ms |
256 KB |
Output is correct |
29 |
Correct |
5 ms |
256 KB |
Output is correct |
30 |
Correct |
4 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
256 KB |
Output is correct |
32 |
Correct |
3 ms |
256 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 |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
128 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 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 |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
4 ms |
256 KB |
Output is correct |
24 |
Correct |
4 ms |
376 KB |
Output is correct |
25 |
Correct |
4 ms |
252 KB |
Output is correct |
26 |
Correct |
4 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
256 KB |
Output is correct |
28 |
Correct |
5 ms |
256 KB |
Output is correct |
29 |
Correct |
5 ms |
256 KB |
Output is correct |
30 |
Correct |
4 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
256 KB |
Output is correct |
32 |
Correct |
3 ms |
256 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 |
5 ms |
376 KB |
Output is correct |
38 |
Correct |
240 ms |
2016 KB |
Output is correct |
39 |
Correct |
238 ms |
2044 KB |
Output is correct |
40 |
Correct |
234 ms |
2096 KB |
Output is correct |
41 |
Correct |
239 ms |
2028 KB |
Output is correct |
42 |
Correct |
308 ms |
2012 KB |
Output is correct |
43 |
Correct |
252 ms |
2028 KB |
Output is correct |
44 |
Correct |
248 ms |
2108 KB |
Output is correct |
45 |
Correct |
293 ms |
2052 KB |
Output is correct |
46 |
Correct |
240 ms |
2028 KB |
Output is correct |
47 |
Correct |
213 ms |
1896 KB |
Output is correct |
48 |
Correct |
213 ms |
1936 KB |
Output is correct |
49 |
Correct |
192 ms |
1816 KB |
Output is correct |
50 |
Correct |
190 ms |
1772 KB |
Output is correct |
51 |
Correct |
393 ms |
2064 KB |
Output is correct |
52 |
Correct |
239 ms |
2024 KB |
Output is correct |
53 |
Correct |
236 ms |
2032 KB |
Output is correct |
54 |
Correct |
233 ms |
2024 KB |
Output is correct |
55 |
Correct |
240 ms |
2160 KB |
Output is correct |
56 |
Correct |
157 ms |
1520 KB |
Output is correct |
57 |
Correct |
82 ms |
1012 KB |
Output is correct |
58 |
Correct |
159 ms |
1556 KB |
Output is correct |
59 |
Correct |
158 ms |
1516 KB |
Output is correct |
60 |
Correct |
84 ms |
1012 KB |
Output is correct |
61 |
Correct |
138 ms |
1408 KB |
Output is correct |
62 |
Correct |
238 ms |
2060 KB |
Output is correct |
63 |
Correct |
241 ms |
2144 KB |
Output is correct |
64 |
Correct |
239 ms |
2000 KB |
Output is correct |
65 |
Correct |
239 ms |
2128 KB |
Output is correct |
66 |
Correct |
239 ms |
2004 KB |
Output is correct |
67 |
Correct |
239 ms |
2052 KB |
Output is correct |
68 |
Correct |
239 ms |
2028 KB |
Output is correct |
69 |
Correct |
241 ms |
2028 KB |
Output is correct |
70 |
Correct |
242 ms |
2144 KB |
Output is correct |
71 |
Correct |
238 ms |
2028 KB |
Output is correct |
72 |
Correct |
246 ms |
1972 KB |
Output is correct |
73 |
Correct |
248 ms |
2140 KB |
Output is correct |