#include "xylophone.h"
#include<bits/stdc++.h>
using namespace std;
static int A[5000];
void solve(int N) {
int n=N;
int x=n-1;
for(int i=2;i<N;i++){
if(query(i,N)!=N-1){
x=i-1;
break;
}
}
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 |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |