Submission #704049

# Submission time Handle Problem Language Result Execution time Memory
704049 2023-03-01T13:10:21 Z 1075508020060209tc Exhibition (JOI19_ho_t2) C++14
100 / 100
131 ms 5588 KB
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;int m;
pair<int,int>paint[500005];
int buc[500005];

int ok(int mi){
int it=m-mi+1;
for(int i=1;i<=n;i++){
    if(buc[it]>=paint[i].second){
        it++;
        if(it==m+1){return 1;}
    }
}
return 0;
}


signed main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
    cin>>paint[i].second>>paint[i].first;
}
sort(paint+1,paint+n+1);
for(int i=1;i<=m;i++){
    cin>>buc[i];
}
sort(buc+1,buc+m+1);

int l=0;int r=m;
while(l<r){
    int mi=l+(r-l+1)/2;
    if(ok(mi)){
        l=mi;
    }else{
        r=mi-1;
    }
}
cout<<l<<endl;


}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 212 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 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 304 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 212 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 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 304 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 320 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 320 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Correct 3 ms 320 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 2 ms 352 KB Output is correct
29 Correct 2 ms 340 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 320 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 2 ms 320 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 212 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 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 304 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 320 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 320 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Correct 3 ms 320 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 2 ms 352 KB Output is correct
29 Correct 2 ms 340 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 320 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 2 ms 320 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 120 ms 5544 KB Output is correct
39 Correct 119 ms 5476 KB Output is correct
40 Correct 115 ms 5588 KB Output is correct
41 Correct 118 ms 5484 KB Output is correct
42 Correct 121 ms 5452 KB Output is correct
43 Correct 122 ms 5428 KB Output is correct
44 Correct 122 ms 5460 KB Output is correct
45 Correct 118 ms 5516 KB Output is correct
46 Correct 121 ms 5448 KB Output is correct
47 Correct 117 ms 4912 KB Output is correct
48 Correct 112 ms 4976 KB Output is correct
49 Correct 94 ms 4436 KB Output is correct
50 Correct 93 ms 4416 KB Output is correct
51 Correct 119 ms 5476 KB Output is correct
52 Correct 119 ms 5492 KB Output is correct
53 Correct 119 ms 5492 KB Output is correct
54 Correct 117 ms 5452 KB Output is correct
55 Correct 121 ms 5456 KB Output is correct
56 Correct 81 ms 3716 KB Output is correct
57 Correct 41 ms 2028 KB Output is correct
58 Correct 76 ms 3700 KB Output is correct
59 Correct 77 ms 3692 KB Output is correct
60 Correct 42 ms 2048 KB Output is correct
61 Correct 71 ms 3256 KB Output is correct
62 Correct 123 ms 5480 KB Output is correct
63 Correct 124 ms 5452 KB Output is correct
64 Correct 131 ms 5452 KB Output is correct
65 Correct 122 ms 5544 KB Output is correct
66 Correct 122 ms 5436 KB Output is correct
67 Correct 123 ms 5452 KB Output is correct
68 Correct 123 ms 5524 KB Output is correct
69 Correct 124 ms 5472 KB Output is correct
70 Correct 119 ms 5516 KB Output is correct
71 Correct 122 ms 5540 KB Output is correct
72 Correct 121 ms 5552 KB Output is correct
73 Correct 121 ms 5452 KB Output is correct