Submission #129016

#TimeUsernameProblemLanguageResultExecution timeMemory
129016win11905Minerals (JOI19_minerals)C++14
40 / 100
34 ms2676 KiB
#include <bits/stdc++.h> #include "minerals.h" using namespace std; vector<int> s1, s2; void solve(vector<int> v, int l, int r) { if(l == r) return Answer(v[0], s1[l]); int m = (l + r) / 2; for(int i = l; i <= m; ++i) Query(s1[i]); vector<int> a1, a2; for(auto x : v) if(Query(x) != (m-l+1)) a2.emplace_back(x), Query(x); else a1.emplace_back(x), Query(x); for(int i = l; i <= m; ++i) Query(s1[i]); solve(a1, l, m), solve(a2, m+1, r); } void Solve(int N) { int pre = 0; for(int i = 1; i <= 2*N; ++i) { int v = Query(i); if(v != pre) s1.emplace_back(i), pre = v; else s2.emplace_back(i), Query(i); } for(int i = 0; i < N; ++i) Query(s1[i]); solve(s2, 0, N-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...