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 "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> v;
void dc(int a,int b,vector<int> &c){
//cout<<a<<' '<<b<<' '<<c.size()<<endl;
if(b-a==1){
v[a]=c[0];
return;
}
int t=0;
int m=(a+b)>>1;
for(int i=a;i<m;i++){
t=Query(i);
}
vector<int> c1,c2;
for(int i:c){
int t1=Query(i);
if(t1!=t){
Query(i);
c2.push_back(i);
}
else{
c1.push_back(i);
}
}
for(int i:c1){
Query(i);
}
for(int i=a;i<m;i++){
t=Query(i);
}
dc(a,m,c1);
dc(m,b,c2);
}
void Solve(int N) {
n=N;
v.resize(N*2+1,-1);
vector<int> c;
for(int i=N+1;i<=N*2;i++){
c.push_back(i);
}
dc(1,N+1,c);
for(int i=1;i<=n;i++){
Answer(i,v[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... |