結果

問題 No.2537 多重含意
ユーザー 👑 p-adicp-adic
提出日時 2023-04-11 22:40:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,661 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 73,672 KB
実行使用メモリ 7,480 KB
最終ジャッジ日時 2023-09-27 15:58:02
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,480 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,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 誤解法(O(N^2 2^N)愚直解)チェック
#pragma GCC optimize ( "O3" )
#pragma GCC optimize( "unroll-loops" )
#pragma GCC target ( "sse4.2,fma,avx2,popcnt,lzcnt,bmi2" )
#include <iostream>
#include <stdio.h>
#include <stdint.h>
#include <cassert>
using namespace std;

using ll = long long;

#define MAIN main
#define TYPE_OF( VAR ) remove_const<remove_reference<decltype( VAR )>::type >::type
#define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr )
#define CEXPR( LL , BOUND , VALUE ) constexpr const LL BOUND = VALUE
#define CIN( LL , A ) LL A; cin >> A
#define ASSERT( A , MIN , MAX ) assert( ( MIN ) <= A && A <= ( MAX ) )
#define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX )
#define FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( TYPE_OF( FINAL_PLUS_ONE ) VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ )
#define FOREQINV( VAR , INITIAL , FINAL ) for( TYPE_OF( INITIAL ) VAR = INITIAL ; VAR >= FINAL ; VAR -- )
#define QUIT return 0
#define COUT( ANSWER ) cout << ( ANSWER ) << "\n"

int MAIN()
{
  UNTIE;
  CEXPR( int , bound_N , 100000 );
  CIN_ASSERT( N , 1 , bound_N );
  CEXPR( int , bound_B , 1000000000 );
  CIN_ASSERT( B , 1 , bound_B );
  bool inA[bound_N] = {};
  ll powerA[bound_N];
  ll one = 1;
  ll powerN = one << N;
  FOR( j , 0 , N ){
    CIN_ASSERT( Aj , 1 , N );
    powerA[j] = one << --Aj;
    int answer = 0;
    FOR( ta , 0 , powerN ){
      ll& powerAj = powerA[j];
      bool b = ( ta & powerAj ) == powerAj;
      FOREQINV( L , j-1  , 0 ){
	b = ( ta & powerA[L] ) == 0 || b;
      }
      b ? ++answer < B ? answer : answer -= B : answer;
    }
    COUT( answer );
  }
  QUIT;
}
0