結果

問題 No.1719 Tree and Permutation
ユーザー zkouzkou
提出日時 2021-09-23 17:12:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 79,180 KB
最終ジャッジ日時 2023-10-24 11:29:25
合計ジャッジ時間 1,844 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,536 KB
testcase_01 AC 137 ms
75,960 KB
testcase_02 AC 125 ms
75,840 KB
testcase_03 AC 141 ms
79,180 KB
testcase_04 AC 137 ms
77,844 KB
testcase_05 AC 139 ms
78,444 KB
testcase_06 AC 140 ms
78,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

T = int(input())
for _ in range(T):
    N = int(input())
    deg = [0] * N
    for _ in range(N - 1):
        u, v = map(int, input().split())
        u -= 1; v -= 1
        deg[u] += 1
        deg[v] += 1
    print("Yes" if deg.count(1) * 2 >= N else "No")
    
0