이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |