# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724854 | 2023-04-16T05:37:22 Z | guagua0407 | Exhibition (JOI19_ho_t2) | C++17 | 284 ms | 10704 KB |
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } const int mxn=1e5+5; pair<int,int> num[mxn]; int C[mxn]; int pos[mxn]; vector<int> vals[mxn]; int n,m; bool check(int mid){ priority_queue<int,vector<int>,greater<int>> pq; for(int i=1;i<mid;i++){ for(auto v:vals[i]){ pq.push(v); } } int cur=-1; for(int i=mid;i<=m;i++){ for(auto v:vals[i]){ pq.push(v); } while(!pq.empty() and pq.top()<cur) pq.pop(); if(pq.empty()) return false; cur=pq.top(); pq.pop(); } return true; } int main() {_ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>num[i].f>>num[i].s; } for(int i=1;i<=m;i++){ cin>>C[i]; } sort(C+1,C+m+1); for(int i=1;i<=n;i++){ pos[i]=lower_bound(C+1,C+m+1,num[i].f)-C; vals[pos[i]].push_back(num[i].s); } int l=1,r=m+1; while(l<r){ int mid=(l+r)/2; if(check(mid)){ r=mid; } else{ l=mid+1; } } cout<<m+1-l; return 0; } //maybe its multiset not set
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 1 ms | 2644 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2644 KB | Output is correct |
8 | Correct | 2 ms | 2684 KB | Output is correct |
9 | Correct | 3 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2644 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2644 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 2 ms | 2680 KB | Output is correct |
16 | Correct | 2 ms | 2680 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 2 ms | 2680 KB | Output is correct |
19 | Correct | 2 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 1 ms | 2644 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2644 KB | Output is correct |
8 | Correct | 2 ms | 2684 KB | Output is correct |
9 | Correct | 3 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2644 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2644 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 2 ms | 2680 KB | Output is correct |
16 | Correct | 2 ms | 2680 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 2 ms | 2680 KB | Output is correct |
19 | Correct | 2 ms | 2680 KB | Output is correct |
20 | Correct | 4 ms | 2772 KB | Output is correct |
21 | Correct | 3 ms | 2736 KB | Output is correct |
22 | Correct | 2 ms | 2724 KB | Output is correct |
23 | Correct | 2 ms | 2644 KB | Output is correct |
24 | Correct | 3 ms | 2692 KB | Output is correct |
25 | Correct | 3 ms | 2644 KB | Output is correct |
26 | Correct | 4 ms | 2644 KB | Output is correct |
27 | Correct | 2 ms | 2644 KB | Output is correct |
28 | Correct | 3 ms | 2644 KB | Output is correct |
29 | Correct | 4 ms | 2720 KB | Output is correct |
30 | Correct | 3 ms | 2692 KB | Output is correct |
31 | Correct | 3 ms | 2644 KB | Output is correct |
32 | Correct | 3 ms | 2708 KB | Output is correct |
33 | Correct | 2 ms | 2644 KB | Output is correct |
34 | Correct | 4 ms | 2644 KB | Output is correct |
35 | Correct | 2 ms | 2680 KB | Output is correct |
36 | Correct | 4 ms | 2692 KB | Output is correct |
37 | Correct | 4 ms | 2644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 1 ms | 2644 KB | Output is correct |
5 | Correct | 1 ms | 2644 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2644 KB | Output is correct |
8 | Correct | 2 ms | 2684 KB | Output is correct |
9 | Correct | 3 ms | 2644 KB | Output is correct |
10 | Correct | 2 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2644 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2644 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 2 ms | 2680 KB | Output is correct |
16 | Correct | 2 ms | 2680 KB | Output is correct |
17 | Correct | 2 ms | 2680 KB | Output is correct |
18 | Correct | 2 ms | 2680 KB | Output is correct |
19 | Correct | 2 ms | 2680 KB | Output is correct |
20 | Correct | 4 ms | 2772 KB | Output is correct |
21 | Correct | 3 ms | 2736 KB | Output is correct |
22 | Correct | 2 ms | 2724 KB | Output is correct |
23 | Correct | 2 ms | 2644 KB | Output is correct |
24 | Correct | 3 ms | 2692 KB | Output is correct |
25 | Correct | 3 ms | 2644 KB | Output is correct |
26 | Correct | 4 ms | 2644 KB | Output is correct |
27 | Correct | 2 ms | 2644 KB | Output is correct |
28 | Correct | 3 ms | 2644 KB | Output is correct |
29 | Correct | 4 ms | 2720 KB | Output is correct |
30 | Correct | 3 ms | 2692 KB | Output is correct |
31 | Correct | 3 ms | 2644 KB | Output is correct |
32 | Correct | 3 ms | 2708 KB | Output is correct |
33 | Correct | 2 ms | 2644 KB | Output is correct |
34 | Correct | 4 ms | 2644 KB | Output is correct |
35 | Correct | 2 ms | 2680 KB | Output is correct |
36 | Correct | 4 ms | 2692 KB | Output is correct |
37 | Correct | 4 ms | 2644 KB | Output is correct |
38 | Correct | 159 ms | 10524 KB | Output is correct |
39 | Correct | 105 ms | 8028 KB | Output is correct |
40 | Correct | 191 ms | 8080 KB | Output is correct |
41 | Correct | 161 ms | 8952 KB | Output is correct |
42 | Correct | 42 ms | 7644 KB | Output is correct |
43 | Correct | 46 ms | 7592 KB | Output is correct |
44 | Correct | 211 ms | 10704 KB | Output is correct |
45 | Correct | 265 ms | 9096 KB | Output is correct |
46 | Correct | 183 ms | 8296 KB | Output is correct |
47 | Correct | 251 ms | 8656 KB | Output is correct |
48 | Correct | 180 ms | 7852 KB | Output is correct |
49 | Correct | 183 ms | 7728 KB | Output is correct |
50 | Correct | 143 ms | 7040 KB | Output is correct |
51 | Correct | 43 ms | 7632 KB | Output is correct |
52 | Correct | 44 ms | 7608 KB | Output is correct |
53 | Correct | 43 ms | 7496 KB | Output is correct |
54 | Correct | 243 ms | 8544 KB | Output is correct |
55 | Correct | 125 ms | 9040 KB | Output is correct |
56 | Correct | 29 ms | 6580 KB | Output is correct |
57 | Correct | 20 ms | 3968 KB | Output is correct |
58 | Correct | 41 ms | 7296 KB | Output is correct |
59 | Correct | 50 ms | 7276 KB | Output is correct |
60 | Correct | 20 ms | 3956 KB | Output is correct |
61 | Correct | 114 ms | 6156 KB | Output is correct |
62 | Correct | 254 ms | 9136 KB | Output is correct |
63 | Correct | 253 ms | 9304 KB | Output is correct |
64 | Correct | 284 ms | 9196 KB | Output is correct |
65 | Correct | 266 ms | 9148 KB | Output is correct |
66 | Correct | 268 ms | 9144 KB | Output is correct |
67 | Correct | 283 ms | 9144 KB | Output is correct |
68 | Correct | 274 ms | 9260 KB | Output is correct |
69 | Correct | 250 ms | 8868 KB | Output is correct |
70 | Correct | 254 ms | 9176 KB | Output is correct |
71 | Correct | 237 ms | 8568 KB | Output is correct |
72 | Correct | 224 ms | 8548 KB | Output is correct |
73 | Correct | 224 ms | 8220 KB | Output is correct |