Submission #1128639

#TimeUsernameProblemLanguageResultExecution timeMemory
1128639vladiliusMinerals (JOI19_minerals)C++20
0 / 100
0 ms416 KiB
#include <bits/stdc++.h> #include "minerals.h" using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second void Solve(int n){ vector<bool> us(2 * n + 1); int S = 0; for (int i = 1; i <= 2 * n; i++){ if (Query(i) > S){ S++; us[i] = 1; } } vector<int> lf = {0}, rr; for (int i = 1; i <= 2 * n; i++){ if (us[i]){ lf.pb(i); continue; } rr.pb(i); } for (int i: lf) Query(i); vector<bool> U(2 * n + 1); int tr = 0; S = n; function<void(int, int, vector<int>)> solve = [&](int l, int r, vector<int> f){ if (f.empty()) return; if (l == r){ Answer(lf[l], f[0]); return; } int m = (l + r) / 2; while (tr < m){ S = Query(lf[++tr]); } while (tr > m){ S = Query(lf[tr--]); } vector<int> left, right; for (int i: f){ int S1 = Query(i); if (S1 == S){ left.pb(i); } else { S = S1; right.pb(i); } } solve(m + 1, r, right); solve(l, m, left); }; solve(1, n, rr); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...