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<bits/stdc++.h>
using namespace std;
int query(int a, int b, int c, int d);
int solve(int n, int* l, int* r){
for(int i=0;i<n;i++)l[i]=r[i]=-1;
vector<int>chain{0};
for(int i=1;i<n;i++){
int last=-1;
while(chain.size()){
int res=query(chain.back(),chain.back(),chain.back(),i);
if(res==1){
r[chain.back()]=i;
break;
}else{
last=chain.back();
chain.pop_back();
}
}
l[i]=last;
chain.push_back(i);
}
return chain[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |