結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,488 KB
testcase_01 AC 442 ms
76,768 KB
testcase_02 AC 328 ms
76,344 KB
testcase_03 AC 351 ms
80,156 KB
testcase_04 AC 341 ms
80,236 KB
testcase_05 AC 342 ms
79,776 KB
testcase_06 AC 342 ms
80,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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