Submission #1072680

#TimeUsernameProblemLanguageResultExecution timeMemory
1072680boyliguanhanMinerals (JOI19_minerals)C++17
80 / 100
247 ms7264 KiB
#include "minerals.h" #include<bits/stdc++.h> using namespace std; set<int>st; int query(int k){ if(st.count(k)) st.erase(k); else st.insert(k); return Query(k); } void solve(vector<int>A,vector<int>B,int dep){ if(A.size()==1) return Answer(A[0],B[0]); vector<int>A1,A2; vector<int>B1,B2; for(auto i:A) A1.push_back(i),swap(A1,A2); int prv=0; for(auto i:A1) prv=query(i); for(auto i:B) { int x=query(i); if(st.count(A1[0])^(x==prv)) B2.push_back(i); else B1.push_back(i); prv=x; } solve(A1,B1,dep^1); solve(A2,B2,dep^1); } void Solve(int N) { vector<int>A,B; int prv=0; for(int i=1;i<=2*N;i++) if(query(i)!=prv) A.push_back(i),prv++; else B.push_back(i); solve(A,B,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...