Submission #200916

#TimeUsernameProblemLanguageResultExecution timeMemory
200916EntityITMinerals (JOI19_minerals)C++14
40 / 100
38 ms2232 KiB
#include "minerals.h" #include<bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define sz(x) ( (int)(x).size() ) using LL = long long; int n; vector<int> part[2]; int prv = 0; bool query(int x) { int cur = Query(x); bool ret = (cur != prv); prv = cur; return ret; } void solve(int Left, int Right, const vector<int> &candidate) { if (Left == Right) { Answer(part[0][Left], candidate[0] ); return ; } int Mid = (Left + Right) >> 1; vector<int> nCandidate[2]; for (int i = Mid + 1; i <= Right; ++i) query(part[0][i]); for (auto i : candidate) nCandidate[query(i)].emplace_back(i); solve(Left, Mid, nCandidate[0]); for (int i = Left; i <= Right; ++i) query(part[0][i]); solve(Mid + 1, Right, nCandidate[1]); } void Solve(int N) { n = N; for (int i = 1; i <= n << 1; ++i) part[query(i)].emplace_back(i); solve(0, n - 1, part[1]); }
#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...