結果

問題 No.1719 Tree and Permutation
ユーザー 👑 rin204rin204
提出日時 2024-05-06 00:59:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 460 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 80,256 KB
最終ジャッジ日時 2024-05-06 00:59:06
合計ジャッジ時間 4,020 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,840 KB
testcase_01 AC 460 ms
77,568 KB
testcase_02 AC 312 ms
77,568 KB
testcase_03 AC 314 ms
80,256 KB
testcase_04 AC 344 ms
79,744 KB
testcase_05 AC 314 ms
79,616 KB
testcase_06 AC 317 ms
80,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    deg = [0] * n
    for _ in range(n - 1):
        a, b = map(int, input().split())
        deg[a - 1] += 1
        deg[b - 1] += 1

    leaf = deg.count(1)
    if leaf * 2 >= n:
        print("Yes")
    else:
        print("No")


for _ in range(int(input())):
    solve()
0