結果

問題 No.2118 遺伝的有限集合の数え上げ
ユーザー roarisroaris
提出日時 2022-11-04 22:40:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 71,752 KB
最終ジャッジ日時 2023-09-26 01:09:27
合計ジャッジ時間 5,613 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,584 KB
testcase_01 AC 87 ms
71,280 KB
testcase_02 AC 84 ms
71,748 KB
testcase_03 AC 90 ms
71,444 KB
testcase_04 AC 85 ms
71,584 KB
testcase_05 AC 85 ms
71,548 KB
testcase_06 AC 86 ms
71,416 KB
testcase_07 AC 89 ms
71,408 KB
testcase_08 AC 85 ms
71,432 KB
testcase_09 AC 87 ms
71,736 KB
testcase_10 AC 86 ms
71,744 KB
testcase_11 AC 83 ms
71,444 KB
testcase_12 AC 84 ms
71,696 KB
testcase_13 AC 86 ms
71,412 KB
testcase_14 AC 85 ms
71,508 KB
testcase_15 AC 84 ms
71,416 KB
testcase_16 AC 83 ms
71,720 KB
testcase_17 AC 86 ms
71,412 KB
testcase_18 AC 94 ms
71,504 KB
testcase_19 AC 84 ms
71,452 KB
testcase_20 AC 84 ms
71,712 KB
testcase_21 AC 85 ms
71,572 KB
testcase_22 AC 84 ms
71,592 KB
testcase_23 AC 86 ms
71,412 KB
testcase_24 AC 85 ms
71,436 KB
testcase_25 AC 87 ms
71,448 KB
testcase_26 AC 87 ms
71,504 KB
testcase_27 AC 87 ms
71,696 KB
testcase_28 AC 87 ms
71,512 KB
testcase_29 AC 87 ms
71,640 KB
testcase_30 AC 87 ms
71,508 KB
testcase_31 AC 86 ms
71,720 KB
testcase_32 AC 88 ms
71,592 KB
testcase_33 AC 87 ms
71,752 KB
testcase_34 AC 87 ms
71,636 KB
testcase_35 AC 90 ms
71,720 KB
testcase_36 AC 88 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def f(x):
    if memo[x]!=-1:
        return memo[x]
    
    if x==0:
        return '{}'
    
    i = 0
    s = []
    t = x
    
    while t:
        if t%2:
            s.append(f(i))
        t //= 2
        i += 1
    
    res = '{'+','.join(list(s))+'}'
    memo[x] = res
    return res

N = int(input())
memo = defaultdict(lambda: -1)
print(f(N))
0