Submission #1105181

#TimeUsernameProblemLanguageResultExecution timeMemory
1105181onlk97Minerals (JOI19_minerals)C++14
70 / 100
16 ms2128 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void Solve(int N){ vector <int> x,y; int prv=0; for (int i=1; i<=2*N; i++){ int tp=Query(i); if (tp==prv) y.push_back(i); else x.push_back(i); prv=tp; } int ans[N]; for (int i=0; i<N; i++) ans[i]=0; for (int b=0; b<16; b++){ for (int i=0; i<N; i++){ int thsx=!!(i&(1<<b)); int lstx=0; if (b) lstx=!!(i&(1<<(b-1))); if (thsx!=lstx){ prv=Query(x[i]); } } for (int i=0; i<N; i++){ int tp=Query(y[i]); if (tp!=prv) ans[i]+=(1<<b); prv=tp; } } for (int i=0; i<N; i++) Answer(x[ans[i]],y[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...