// 愚直に数える解法が通るかチェック // #define _GLIBCXX_DEBUG #include using namespace std; using uint = unsigned int; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define GETLINE( A ) string A; getline( cin , A ) #define GETLINE_SEPARATE( A , SEPARATOR ) string A; getline( cin , A , SEPARATOR ) #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( ll VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define FOREQ( VAR , INITIAL , FINAL ) for( ll VAR = INITIAL ; VAR <= FINAL ; VAR ++ ) #define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ ) #define REPEAT( HOW_MANY_TIMES ) FOR( VARIABLE_FOR_REPEAT , 0 , HOW_MANY_TIMES ) #define QUIT return 0 #define RETURN( ANSWER ) cout << ( ANSWER ) << "\n"; QUIT #define DOUBLE( PRECISION , ANSWER ) cout << fixed << setprecision( PRECISION ) << ( ANSWER ) << "\n"; QUIT #define MIN( A , B ) A < B ? A : B; #define MAX( A , B ) A < B ? B : A; template inline T Absolute( const T& a ){ return a > 0 ? a : - a; } int main() { UNTIE; CIN( int , N ); int A[100001]; FOR( i , 0 , N ){ cin >> A[i]; } int power_max = 1; while( power_max <= N ){ power_max *= 2; } power_max /= 2; int power; int Bj; int Bj_current; int& j_max = A[0]; FOR( j , 1 , j_max ){ power = power_max; Bj = 0; while( power != 0 ){ Bj_current = Bj + power; if( Bj_current < N ? A[Bj_current] >= j : false ){ Bj = Bj_current; } power /= 2; } cout << Bj + 1 << " "; } { power = power_max; Bj = 0; while( power != 0 ){ Bj_current = Bj + power; if( Bj_current < N ? A[Bj_current] >= j_max : false ){ Bj = Bj_current; } power /= 2; } cout << Bj + 1 << "\n"; } QUIT; }