# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
378157 | 2021-03-16T05:43:22 Z | 2qbingxuan | Minerals (JOI19_minerals) | C++14 | 0 ms | 0 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void dq(vector<int> A, vector<int> B) { assert(A.size() == B.size()); if (A.empty()) return; if (A.size() == 1) { // cerr << "cand.size() = " << cand.size() << endl; Answer(A[0], B[0]); return; } int m = A.size() / 2; int cur = -1; for (int i = 0; i < m; i++) cur = Query(A[i]); vector<int> L, R; for (int x: B) { if (Query(x) == cur) { L.push_back(x); } else { R.push_back(x); } Query(x); } for (int i = 0; i < m; i++) Query(A[i]); dq(vector<int>(A.begin(), A.begin() + m), L); dq(vector<int>(A.begin() + m, A.end()), R); } int f(int n) { int dep = __lg(n) + 1; return n * 6 * dep; } void Solve(int N) { vector<int> cand; int cur = 0; for (int i = 1; i <= N*2; i++) { int q = Query(i); if (q == cur) { Query(i); A.push_back(i); } else { B.push_back(i); } cur = q; } cerr << cand.size() << '\n'; dq(A, B); cerr << f(N) << '\n'; // for (int i = 1; i <= 50; i++) cerr << i << ' ' << f(i) << endl; /* 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); } */ }