# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
101872 |
2019-03-20T15:35:41 Z |
brcode |
Exhibition (JOI19_ho_t2) |
C++14 |
|
236 ms |
5500 KB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,m;
const int MAXN = 100100;
pair<int,int> v1[MAXN];
int arr[MAXN];
bool check(int x){
vector<int> v2;
for(int i=m;i>(m-x);i--){
v2.push_back(arr[i]);
}
for(int i=1;i<=n;i++){
if(v2.empty()){
return true;
}
if(v1[i].second<=v2.back()){
v2.pop_back();
}
}
if(v2.empty()){
return true;
}
return false;
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>v1[i].second>>v1[i].first;
}
for(int i=1;i<=m;i++){
cin>>arr[i];
}
sort(v1+1,v1+1+n);
sort(arr+1,arr+1+m);
int l= 0;
int r = m;
int ans = 0;
while(l<=r){
int mid = (l+r)/2;
if(check(mid)){
ans = mid;
l = mid+1;
}else{
r = mid-1;
}
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
304 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
3 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
304 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
3 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 |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
3 ms |
384 KB |
Output is correct |
23 |
Correct |
4 ms |
384 KB |
Output is correct |
24 |
Correct |
4 ms |
384 KB |
Output is correct |
25 |
Correct |
3 ms |
384 KB |
Output is correct |
26 |
Correct |
4 ms |
384 KB |
Output is correct |
27 |
Correct |
3 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 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 |
256 KB |
Output is correct |
34 |
Correct |
3 ms |
384 KB |
Output is correct |
35 |
Correct |
3 ms |
384 KB |
Output is correct |
36 |
Correct |
2 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
304 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
3 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 |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
3 ms |
384 KB |
Output is correct |
23 |
Correct |
4 ms |
384 KB |
Output is correct |
24 |
Correct |
4 ms |
384 KB |
Output is correct |
25 |
Correct |
3 ms |
384 KB |
Output is correct |
26 |
Correct |
4 ms |
384 KB |
Output is correct |
27 |
Correct |
3 ms |
384 KB |
Output is correct |
28 |
Correct |
4 ms |
384 KB |
Output is correct |
29 |
Correct |
4 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 |
256 KB |
Output is correct |
34 |
Correct |
3 ms |
384 KB |
Output is correct |
35 |
Correct |
3 ms |
384 KB |
Output is correct |
36 |
Correct |
2 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
38 |
Correct |
172 ms |
5404 KB |
Output is correct |
39 |
Correct |
166 ms |
5428 KB |
Output is correct |
40 |
Correct |
186 ms |
5500 KB |
Output is correct |
41 |
Correct |
162 ms |
5432 KB |
Output is correct |
42 |
Correct |
150 ms |
4848 KB |
Output is correct |
43 |
Correct |
159 ms |
4824 KB |
Output is correct |
44 |
Correct |
156 ms |
5168 KB |
Output is correct |
45 |
Correct |
158 ms |
5396 KB |
Output is correct |
46 |
Correct |
218 ms |
5428 KB |
Output is correct |
47 |
Correct |
144 ms |
4876 KB |
Output is correct |
48 |
Correct |
163 ms |
4872 KB |
Output is correct |
49 |
Correct |
134 ms |
4520 KB |
Output is correct |
50 |
Correct |
149 ms |
4388 KB |
Output is correct |
51 |
Correct |
229 ms |
4856 KB |
Output is correct |
52 |
Correct |
184 ms |
5032 KB |
Output is correct |
53 |
Correct |
192 ms |
4796 KB |
Output is correct |
54 |
Correct |
178 ms |
5492 KB |
Output is correct |
55 |
Correct |
236 ms |
5480 KB |
Output is correct |
56 |
Correct |
111 ms |
3132 KB |
Output is correct |
57 |
Correct |
55 ms |
2040 KB |
Output is correct |
58 |
Correct |
99 ms |
3064 KB |
Output is correct |
59 |
Correct |
97 ms |
3064 KB |
Output is correct |
60 |
Correct |
65 ms |
2172 KB |
Output is correct |
61 |
Correct |
97 ms |
2992 KB |
Output is correct |
62 |
Correct |
178 ms |
5240 KB |
Output is correct |
63 |
Correct |
174 ms |
5256 KB |
Output is correct |
64 |
Correct |
153 ms |
5448 KB |
Output is correct |
65 |
Correct |
180 ms |
5168 KB |
Output is correct |
66 |
Correct |
217 ms |
5168 KB |
Output is correct |
67 |
Correct |
156 ms |
5384 KB |
Output is correct |
68 |
Correct |
157 ms |
5168 KB |
Output is correct |
69 |
Correct |
192 ms |
5160 KB |
Output is correct |
70 |
Correct |
171 ms |
5256 KB |
Output is correct |
71 |
Correct |
219 ms |
5168 KB |
Output is correct |
72 |
Correct |
170 ms |
5216 KB |
Output is correct |
73 |
Correct |
146 ms |
5168 KB |
Output is correct |