結果

問題 No.566 だいたい完全二分木
ユーザー rlangevinrlangevin
提出日時 2023-01-13 00:37:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 76,740 KB
最終ジャッジ日時 2023-08-25 04:28:44
合計ジャッジ時間 2,102 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,528 KB
testcase_01 AC 68 ms
71,200 KB
testcase_02 AC 68 ms
71,044 KB
testcase_03 AC 67 ms
71,316 KB
testcase_04 AC 67 ms
71,200 KB
testcase_05 AC 69 ms
71,400 KB
testcase_06 AC 68 ms
71,248 KB
testcase_07 AC 69 ms
71,376 KB
testcase_08 AC 79 ms
75,484 KB
testcase_09 AC 84 ms
76,740 KB
testcase_10 AC 86 ms
76,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(L):
    M = len(L)//2
    if M == 0:
        ans.append(L[0])
        return 
    ans.append(L[M])
    f(L[:M])
    f(L[M+1:])
    return
    

K = int(input())
N = 1 << K
L = list(range(1, N))
ans = []
f(L)
ans[0], ans[1] = ans[1], ans[0]
print(*ans)
0