結果

問題 No.2118 遺伝的有限集合の数え上げ
ユーザー Nikkuniku029Nikkuniku029
提出日時 2022-11-04 22:00:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 828 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 253,872 KB
最終ジャッジ日時 2023-09-26 00:24:50
合計ジャッジ時間 6,763 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,288 KB
testcase_01 AC 89 ms
71,796 KB
testcase_02 AC 81 ms
71,588 KB
testcase_03 AC 79 ms
71,448 KB
testcase_04 AC 77 ms
71,580 KB
testcase_05 AC 77 ms
71,572 KB
testcase_06 AC 76 ms
71,568 KB
testcase_07 AC 78 ms
71,616 KB
testcase_08 AC 80 ms
71,840 KB
testcase_09 AC 79 ms
71,452 KB
testcase_10 AC 79 ms
71,632 KB
testcase_11 AC 79 ms
71,652 KB
testcase_12 AC 79 ms
71,852 KB
testcase_13 AC 79 ms
71,768 KB
testcase_14 AC 80 ms
71,832 KB
testcase_15 AC 79 ms
71,688 KB
testcase_16 AC 78 ms
71,608 KB
testcase_17 AC 78 ms
71,676 KB
testcase_18 AC 79 ms
76,308 KB
testcase_19 AC 82 ms
76,100 KB
testcase_20 AC 86 ms
76,424 KB
testcase_21 AC 88 ms
77,160 KB
testcase_22 AC 86 ms
77,000 KB
testcase_23 AC 88 ms
77,268 KB
testcase_24 AC 87 ms
77,128 KB
testcase_25 AC 89 ms
77,172 KB
testcase_26 AC 87 ms
77,112 KB
testcase_27 AC 87 ms
77,012 KB
testcase_28 AC 112 ms
80,436 KB
testcase_29 AC 117 ms
80,728 KB
testcase_30 AC 119 ms
80,760 KB
testcase_31 AC 132 ms
87,048 KB
testcase_32 AC 132 ms
86,684 KB
testcase_33 AC 137 ms
86,732 KB
testcase_34 AC 143 ms
86,900 KB
testcase_35 AC 156 ms
92,620 KB
testcase_36 AC 828 ms
253,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log2, ceil
n = int(input())
dp = ['' for _ in range(n+1)]
dp[0] = '{}'
for i in range(1, n+1):
    tmp = '{'
    arr = []
    for j in range(ceil(log2(i))+1):
        if i & (1 << j):
            arr.append(dp[j])
    tmp += ','.join(arr)+'}'
    dp[i] = tmp
print(dp[n])
0