結果

問題 No.1928 Make a Binary Tree
ユーザー 👑 rin204rin204
提出日時 2022-05-06 21:28:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 282,744 KB
最終ジャッジ日時 2023-09-20 02:21:43
合計ジャッジ時間 23,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,244 KB
testcase_01 AC 67 ms
71,080 KB
testcase_02 AC 68 ms
71,392 KB
testcase_03 AC 67 ms
71,384 KB
testcase_04 AC 68 ms
71,432 KB
testcase_05 AC 68 ms
71,468 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 69 ms
71,360 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 616 ms
201,432 KB
testcase_37 WA -
testcase_38 AC 70 ms
71,432 KB
testcase_39 AC 631 ms
195,620 KB
testcase_40 AC 624 ms
196,452 KB
testcase_41 AC 620 ms
195,320 KB
testcase_42 AC 614 ms
195,880 KB
testcase_43 AC 625 ms
196,252 KB
testcase_44 AC 623 ms
196,856 KB
testcase_45 AC 614 ms
196,280 KB
testcase_46 AC 613 ms
196,088 KB
testcase_47 AC 604 ms
196,176 KB
testcase_48 AC 615 ms
195,416 KB
testcase_49 AC 790 ms
282,744 KB
testcase_50 AC 630 ms
100,252 KB
testcase_51 AC 523 ms
100,280 KB
testcase_52 AC 525 ms
100,244 KB
testcase_53 AC 507 ms
100,392 KB
testcase_54 AC 510 ms
100,420 KB
testcase_55 AC 601 ms
202,952 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 423 ms
113,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 9)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')

n = int(input())
edges = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append(v)
    edges[v].append(u)

def dfs(pos, bpos):
    tmp = -2
    for npos in edges[pos]:
        if npos == bpos:
            continue
        else:
            tmp += dfs(npos, pos) + 1
    
    return max(0, tmp)

ans = dfs(0, -1)
print(n - ans)
0