結果
問題 | No.566 だいたい完全二分木 |
ユーザー | sho_00 |
提出日時 | 2020-04-12 15:19:40 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 535 ms |
コンパイル使用メモリ | 81,628 KB |
実行使用メモリ | 59,572 KB |
最終ジャッジ日時 | 2023-10-22 01:17:28 |
合計ジャッジ時間 | 3,285 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,540 KB |
testcase_01 | AC | 35 ms
53,540 KB |
testcase_02 | AC | 35 ms
53,540 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
ソースコード
import math,sys K=int(input()) if K==2: ans=['1','3','2'] print(' '.join(ans)) sys.exit() v=2**(K-1)+1 P=[str(v)] left=[str(i) for i in range(1,v)] right=[str(i) for i in range(v+1,2**K)] tmp=K-1 while tmp!=0: if tmp==K-1 and K>=4: P+=left[2**(tmp-1):2**tmp+1] elif tmp==1: P+=['1'] else: P+=left[2**(tmp-1)-1:2**tmp] tmp-=1 right_root=right[len(right)//2] P.append(right_root) right.remove(right_root) P+=right print(' '.join(P))