Submission #927237

#TimeUsernameProblemLanguageResultExecution timeMemory
927237Gromp15Exhibition (JOI19_ho_t2)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #define ll long long #define ar array #define db double #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define rint(l, r) uniform_int_distribution<int>(l, r)(rng) template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } void test_case() { int n, m; cin >> n >> m; vector<int> X, Y; vector<ar<int, 2>> a(n); for (auto &x : a) cin >> x[0] >> x[1], X.push_back(x[0]), Y.push_back(x[1]); vector<int> s(m); for (int &x : s) cin >> x, X.push_back(x); sort(all(X)); sort(all(Y)); X.erase(unique(all(X)), X.end()); Y.erase(unique(all(Y)), Y.end()); for (auto &x : a) { x[0] = lower_bound(all(X), x[0]) - X.begin(); x[1] = lower_bound(all(Y), x[1]) - Y.begin(); } for (int &x : s) { x = lower_bound(all(X), x) - X.begin(); } sort(all(a)); sort(all(s)); int ans = 0; for (int mask = 0; mask < 1 << n; mask++) { vector<ar<int, 2>> cur; for (int i = 0; i < n; i++) if (mask >> i & 1) cur.push_back(a[i]); bool ok = 1; for (int i = 1; i < sz(cur); i++) { if (cur[i][0] < cur[i-1][0] || cur[i][1] < cur[i-1][1]) { ok = 0; break; } } if (ok) { for (int i = 0; i < sz(cur); i++) { int cnt = 0; for (int x : s) cnt += x >= cur[i][0]; if (cnt < sz(cur) - i) { ok = 0; break; } } if (ok) ckmax(ans, sz(cur)); } } cout << ans << '\n'; } int main() { cin.tie(0)->sync_with_stdio(0); int t = 1; // cin >> t; while (t--) test_case(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...