제출 #1169940

#제출 시각아이디문제언어결과실행 시간메모리
1169940patgraMinerals (JOI19_minerals)C++20
0 / 100
0 ms416 KiB
#include <bits/stdc++.h> #define rep(a,b,c) for(auto a = (b); a != (c); a++) #define repD(a,b,c) for(auto a = (b); a != (c); a--) #define repIn(a, b) for(auto& a : (b)) #define repIn2(a, b, c) for(auto& [a, b] : (c)) constexpr bool dbg = 0; #define DEBUG if constexpr(dbg) #define DC DEBUG std::cerr #define eol std::endl #define ll long long #define pb push_back using namespace std; #include "minerals.h" int n; int myQuery(int i) { int ret = Query(i + 1); DC << " ============ Querying " << i << " -> " << ret << eol; return ret; } int curPairs; void dq(vector<int> h1, vector<int> h2, bool in1, bool in2) { DEBUG { DC << "D&Q\n h1: {"; repIn(i, h1) DC << i << ", "; DC << "}\n h2: {"; repIn(i, h2) DC << i << ", "; DC << "}\n in1 " << in1 << " ; in2 " << in2 << eol; } int sz = h1.size(), m = sz / 2; if(sz == 1) { Answer(h1.back(), h2.back()); return; } if(in1) rep(i, m, h1.size()) curPairs = myQuery(h1[i]); if(!in1) rep(i, 0, m) curPairs = myQuery(h1[i]); vector<int> lh1, lh2, rh1, rh2; rep(i, 0, m) lh1.pb(h1[i]); rep(i, m, h1.size()) rh1.pb(h2[i]); repIn(i, h2) { auto newPairs = myQuery(i); if(newPairs != curPairs) lh2.pb(i); else rh2.pb(i); curPairs = newPairs; } dq(lh1, lh2, true, !in2); dq(rh1, rh2, true, !in2); } void Solve(int N) { n = N; vector<int> firstHalf, secondHalf; rep(i, 0, 2 * N) { if(firstHalf.size() == n) { secondHalf.pb(i); continue; } if(secondHalf.size() == n) { firstHalf.pb(i); continue; } auto newPairs = myQuery(i); if(newPairs) secondHalf.pb(i), myQuery(i); else firstHalf.pb(i); } dq(firstHalf, secondHalf, 1, 0); }
#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...