結果

問題 No.2118 遺伝的有限集合の数え上げ
ユーザー 👑 p-adicp-adic
提出日時 2022-09-14 22:48:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 72,468 KB
実行使用メモリ 34,924 KB
最終ジャッジ日時 2023-09-18 06:07:19
合計ジャッジ時間 3,030 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
34,592 KB
testcase_01 AC 14 ms
34,640 KB
testcase_02 AC 13 ms
34,716 KB
testcase_03 AC 14 ms
34,592 KB
testcase_04 AC 14 ms
34,592 KB
testcase_05 AC 13 ms
34,652 KB
testcase_06 AC 13 ms
34,608 KB
testcase_07 AC 13 ms
34,600 KB
testcase_08 AC 14 ms
34,868 KB
testcase_09 AC 13 ms
34,592 KB
testcase_10 AC 13 ms
34,788 KB
testcase_11 AC 14 ms
34,648 KB
testcase_12 AC 13 ms
34,732 KB
testcase_13 AC 13 ms
34,640 KB
testcase_14 AC 13 ms
34,604 KB
testcase_15 AC 14 ms
34,652 KB
testcase_16 AC 14 ms
34,924 KB
testcase_17 AC 13 ms
34,640 KB
testcase_18 AC 14 ms
34,640 KB
testcase_19 AC 13 ms
34,656 KB
testcase_20 AC 13 ms
34,800 KB
testcase_21 AC 14 ms
34,652 KB
testcase_22 AC 14 ms
34,592 KB
testcase_23 AC 14 ms
34,592 KB
testcase_24 AC 14 ms
34,652 KB
testcase_25 AC 14 ms
34,868 KB
testcase_26 AC 14 ms
34,796 KB
testcase_27 AC 14 ms
34,588 KB
testcase_28 AC 14 ms
34,652 KB
testcase_29 AC 14 ms
34,608 KB
testcase_30 AC 14 ms
34,604 KB
testcase_31 AC 13 ms
34,588 KB
testcase_32 AC 14 ms
34,588 KB
testcase_33 AC 14 ms
34,612 KB
testcase_34 AC 13 ms
34,648 KB
testcase_35 AC 13 ms
34,600 KB
testcase_36 AC 13 ms
34,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;

using uint = unsigned int;

#define CIN( LL , A ) LL A; cin >> A 
#define RETURN( ANSWER ) cout << ( ANSWER ) << endl; return 0 

#include <cassert>

const string& EnumerateHereditarilyFiniteSets( const uint& n )
{
  static string s[1000001] = {};
  string& sn = s[n];  
  if( sn != "" ){
    return sn;
  }
  uint n_copy = n;
  uint i = 0;
  while( n_copy != 0 ){
    if( n_copy % 2 == 1 ){
      sn += "," + EnumerateHereditarilyFiniteSets( i );
    }
    n_copy /= 2;
    i++;
  }
  sn = "{" + ( sn == "" ? sn : sn.substr( 1 ) ) + "}";
  return sn;
}

int main()
{
  CIN( uint , N );
  assert( N <= 1000000 );
  RETURN( EnumerateHereditarilyFiniteSets( N ) );
}
0