# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
799685 | 2023-07-31T20:09:28 Z | n3rm1n | Exhibition (JOI19_ho_t2) | C++17 | 1 ms | 212 KB |
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 1e5 + 10; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, m; vector < pair < int , int > > g; vector < int > frames; void read() { cin >> n >> m; int xx, yy; for (int i = 1; i <= n; ++ i) { cin >> xx >> yy; g.push_back(make_pair(yy, xx)); } sort(g.begin(), g.end()); for (int i = 1; i <= m; ++ i) { cin >> xx; frames.push_back(-xx); } sort(frames.begin(), frames.end()); } vector < int > v; bool check(int goal) { v.clear(); v.push_back(-1); int x; int sz = goal; for (int i = 0; i < g.size(); ++ i) { x = g[i].second; if(x >= (int)v.back() && x <= -frames[sz-1]) { v.push_back(x); sz --; } } return (sz <= 0); } void bin_search() { int l = 1, r = m, mid, ans = 0; while(l <= r) { mid = (l + r)/2; if(check(mid)) { ans = mid; l = mid + 1; } else r = mid - 1; } cout << ans << endl; } int main() { speed(); read(); bin_search(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |