This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |