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"xylophone.h"
#include<iostream>
#include<vector>
using namespace std;
void solve(int n){
vector<int>res(n);
res[0]=0;
res[1]=query(1,2);
int mn=0;
for(int i=2;i<n;i++){
int r1=query(i,i+1);
int r2=query(i-1,i+1);
res[i]=res[i-1]+r1;
if(max(max(res[i-2],res[i-1]),res[i])-min(min(res[i-2],res[i-1]),res[i])!=r2)
res[i]=res[i-1]-r1;
mn=min(mn,res[i]);
}
for(int&i:res)
i-=mn-1;
bool gotn=false;
for(int i:res){
if(i==n)
gotn=true;
if(i==1&&gotn){
for(int&i:res)
i=n-i+1;
break;
}
}
for(int i=0;i<n;i++)
answer(i+1,res[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... |