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;
int ret;
void solv(vector <int> v1, vector <int> v2, int in1, int in2){
int sz=v2.size();
if(sz==1){
Answer(v1[0], v2[0]);
return;
}
vector <int> v11, v12, v21, v22;
int mid=(sz/2);
for(int i=0;i<mid;i++) ret=Query(v1[i]), v11.push_back(v1[i]);
for(int i=mid;i<sz;i++) v12.push_back(v2[i]);
for(int i=0;i<sz;i++){
int nr=Query(v2[i]);
if(nr==ret){
if(in1==1) v22.push_back(v2[i]);
else v21.push_back(v2[i]);
}
else{
if(in1==1) v21.push_back(v2[i]);
else v22.push_back(v2[i]);
}
ret=nr;
}
solv(v11, v21, 1-in1, 1-in2);
solv(v12, v22, in1, 1-in2);
}
void Solve(int N) {
if(N==1){
Answer(1, 2);
return;
}
ret=0;
vector <int> v1, v2;
for(int i=1;i<=2*N;i++){
int nr=Query(i);
if(nr==ret) v2.push_back(i);
else v1.push_back(i);
ret=nr;
}
solv(v1, v2, 1, 1);
}
# | 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... |