結果
| 問題 | No.2118 遺伝的有限集合の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-04 22:40:31 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| + 684µs | |
| コード長 | 380 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 96,368 KB |
| 実行使用メモリ | 79,616 KB |
| 最終ジャッジ日時 | 2026-08-17 16:31:47 |
| 合計ジャッジ時間 | 5,375 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 37 |
ソースコード
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))