結果

問題 No.2092 Conjugation
ユーザー 👑 p-adicp-adic
提出日時 2022-09-19 22:50:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,913 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 198,028 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 19:18:57
合計ジャッジ時間 3,355 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 18 ms
4,380 KB
testcase_09 AC 14 ms
4,380 KB
testcase_10 AC 15 ms
4,376 KB
testcase_11 AC 15 ms
4,380 KB
testcase_12 AC 14 ms
4,376 KB
testcase_13 AC 12 ms
4,380 KB
testcase_14 AC 11 ms
4,376 KB
testcase_15 AC 14 ms
4,380 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 20 ms
4,376 KB
testcase_18 AC 24 ms
4,380 KB
testcase_19 AC 6 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 愚直に数える解法が通るかチェック
// #define _GLIBCXX_DEBUG 
#include<bits/stdc++.h>
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 <typename T> 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;
}
0