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<bits/stdc++.h>
using namespace std;
int A[5000];
void solve(int N) {
int n=N;
int x=1;
int l=x-1,r=x+1;
while(l>0){
if(l==x-1){
int p=query(l,x);
A[l]=1+p;
}
else{
int p=query(l,x);
if(p>=A[l+1]){
A[l]=1+p;
}
else{
A[l]=A[l+1]-p;
}
}
l--;
}
while(r<=n){
if(r==x+1){
int p=query(x,r);
A[r]=1+p;
}
else{
int p=query(x,r);
if(p>=A[r-1]){
A[r]=1+p;
}
else{
A[r]=A[r-1]-p;
}
}
r++;
}
for(int i=1;i<=n;i++){
answer(i,A[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... |