# include <bits/stdc++.h>
# include "xylophone.h"
using namespace std ;
void solve( int N ) {
int L = 1, R = N, cnt;
while( true ) {
if( R - L == 1 ) {
R -- ;
break ;
}
R -- ;
cnt = query( L, R ) ;
if( cnt < N-1 ) break ;
}
while( true ) {
if( R - L == 1 ) {
L ++ ;
break ;
}
L ++ ;
cnt = query( L, R ) ;
if( cnt < N-1 ) break ;
}
L -- ;
R ++ ;
int sm1[N+100];
for( int i = 0 ; i <= N ; i ++ ) sm1[i] = -1 ;
sm1[L] = 1 ;
sm1[R] = N ;
for( int i = L -1 ; i >= 1 ; i -- ) {
cnt = query( i, L ) ;
sm1[i] = 1 + cnt ;
}
for( int i = L + 1 ; i < R ; i ++ ) {
cnt = query( L, i ) ;
sm1[i] = 1 + cnt ;
}
for( int i = R + 1 ; i <= N ; i ++ ) {
cnt = query( R, i ) ;
sm1[i] = N - cnt ;
}
for( int i = 1 ; i <= N ; i ++ ) {
answer(i, sm1[i] ) ;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |