# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
220230 |
2020-04-07T11:47:25 Z |
kai824 |
Exhibition (JOI19_ho_t2) |
C++17 |
|
84 ms |
4476 KB |
#include"bits/stdc++.h"
using namespace std;
pair<int,int> pics[100005];
int fs[100005];//frame size...
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n,m,lo,hi,mid,ans=0;
cin>>n>>m;
for(int x=0;x<n;x++){
cin>>pics[x].second>>pics[x].first;//size, value...
}
sort(pics,pics+n);//by increasing value, then by size...
for(int x=0;x<m;x++){
cin>>fs[x];
}
sort(fs,fs+m);
for(int x=n-1;x>=0;x--){//only care about size of frame...
//find smallest possible index of frame that can fit painting...
if(pics[x].second>fs[m-1])pics[x].first=INT_MAX;
else{
lo=0;hi=m-1;
while(lo<hi){
mid=lo+(hi-lo)/2;
if(pics[x].second<=fs[mid]){//picture fits in frame
hi=mid;
}else{
lo=mid+1;//exceed frame size
}
}
pics[x].first=lo;
}
pics[x].second=x+1;//the index to rmb...
if(pics[x].first==INT_MAX)continue;
if(ans>m-1-pics[x].first)continue;
else ans++;//take the current thing...
}
cout<<ans;
return 0;
}
/*
3 4
10 20
5 1
3 5
4 6 10 4
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
400 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
400 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
28 |
Correct |
7 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
6 ms |
512 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
400 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
28 |
Correct |
7 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
6 ms |
512 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
38 |
Correct |
72 ms |
4344 KB |
Output is correct |
39 |
Correct |
64 ms |
4472 KB |
Output is correct |
40 |
Correct |
63 ms |
4472 KB |
Output is correct |
41 |
Correct |
71 ms |
4464 KB |
Output is correct |
42 |
Correct |
64 ms |
4344 KB |
Output is correct |
43 |
Correct |
66 ms |
4344 KB |
Output is correct |
44 |
Correct |
73 ms |
4344 KB |
Output is correct |
45 |
Correct |
77 ms |
4344 KB |
Output is correct |
46 |
Correct |
68 ms |
4348 KB |
Output is correct |
47 |
Correct |
71 ms |
4036 KB |
Output is correct |
48 |
Correct |
63 ms |
3960 KB |
Output is correct |
49 |
Correct |
63 ms |
3580 KB |
Output is correct |
50 |
Correct |
58 ms |
3580 KB |
Output is correct |
51 |
Correct |
72 ms |
4440 KB |
Output is correct |
52 |
Correct |
64 ms |
4344 KB |
Output is correct |
53 |
Correct |
65 ms |
4416 KB |
Output is correct |
54 |
Correct |
61 ms |
4472 KB |
Output is correct |
55 |
Correct |
73 ms |
4348 KB |
Output is correct |
56 |
Correct |
43 ms |
3064 KB |
Output is correct |
57 |
Correct |
27 ms |
1664 KB |
Output is correct |
58 |
Correct |
43 ms |
3064 KB |
Output is correct |
59 |
Correct |
53 ms |
3064 KB |
Output is correct |
60 |
Correct |
27 ms |
1664 KB |
Output is correct |
61 |
Correct |
50 ms |
2684 KB |
Output is correct |
62 |
Correct |
80 ms |
4344 KB |
Output is correct |
63 |
Correct |
78 ms |
4344 KB |
Output is correct |
64 |
Correct |
78 ms |
4344 KB |
Output is correct |
65 |
Correct |
80 ms |
4344 KB |
Output is correct |
66 |
Correct |
80 ms |
4476 KB |
Output is correct |
67 |
Correct |
79 ms |
4456 KB |
Output is correct |
68 |
Correct |
84 ms |
4472 KB |
Output is correct |
69 |
Correct |
81 ms |
4472 KB |
Output is correct |
70 |
Correct |
79 ms |
4344 KB |
Output is correct |
71 |
Correct |
84 ms |
4348 KB |
Output is correct |
72 |
Correct |
79 ms |
4448 KB |
Output is correct |
73 |
Correct |
73 ms |
4476 KB |
Output is correct |