Submission #376802

#TimeUsernameProblemLanguageResultExecution timeMemory
3768022qbingxuanMinerals (JOI19_minerals)C++17
6 / 100
20 ms1260 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void dq(int l, int r, vector<int> cand) { // cerr << l << ' ' << r << ' ' << " cand = "; // for (int x: cand) cerr << x << ' '; // cerr << endl; if (l == r) { // cerr << "cand.size() = " << cand.size() << endl; assert( cand.size() == 1 ); if (cand[0] < l) Answer(cand[0], l); return; } int m = l+(r-l)/2; int cur = -1; for (int i = l; i <= m; i++) cur = Query(i); vector<int> L, R; for (int x: cand) { if (Query(x) == cur) { L.push_back(x); } else { R.push_back(x); } Query(x); } for (int i = l; i <= m; i++) Query(i); dq(l, m, L); dq(m+1, r, R); } void Solve(int N) { vector<int> jizz(N*2); iota(jizz.begin(), jizz.end(), 1); dq(1, N*2, jizz); /* for (int i = 1; i <= N*2; i++) { Query(i); for (int j = 1; j < i; j++) { if (Query(j) == 1) Answer(i, j); Query(j); } Query(i); } */ }
#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...