Submission #624643

#TimeUsernameProblemLanguageResultExecution timeMemory
624643Do_you_copyMinerals (JOI19_minerals)C++17
40 / 100
25 ms2132 KiB
#include <bits/stdc++.h> #include "minerals.h" #define taskname "test" #define fi first #define se second #define pb push_back #define faster ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; using ll = long long; using ull = unsigned ll; using ld = long double; using pii = pair <int, int>; using pil = pair <int, ll>; using pli = pair <ll, int>; using pll = pair <ll, ll>; mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count()); ll min(const ll &a, const ll &b){ return (a < b) ? a : b; } ll max(const ll &a, const ll &b){ return (a > b) ? a : b; } //const ll Mod = 1000000007; //const ll Mod2 = 999999999989; //only use when required const int maxN = 1e5 + 1; int n; vector <int> a, b; int cur = 0; void parallel_bs(vector <int> &w, int l = 1, int r = n){ if (l == r){ Answer(w.back(), a[l]); w.clear(); return; } int mid = (l + r) / 2; int last = 0; while (cur < mid){ last = Query(a[++cur]); } while (cur > mid){ last = Query(a[cur--]); } vector <int> left, right; for (int i: w){ int tem = Query(i); if (last == tem) left.pb(i); else right.pb(i); Query(i); } w.clear(); parallel_bs(left, l, mid); parallel_bs(right, mid + 1, r); } void Solve(int N){ n = N; int last = 0; a.pb(0); for (int i = 1; i <= 2 * n; ++i){ int tem = Query(i); if (tem > last) a.pb(i); else b.pb(i); last = tem; } for (int i = 1; i <= 2 * n; ++i) Query(i); parallel_bs(b, 1, n); }
#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...