結果

問題 No.1719 Tree and Permutation
ユーザー とりゐとりゐ
提出日時 2022-11-29 00:47:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 79,488 KB
最終ジャッジ日時 2024-04-15 22:04:09
合計ジャッジ時間 2,919 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 190 ms
77,056 KB
testcase_02 AC 175 ms
76,800 KB
testcase_03 AC 202 ms
79,488 KB
testcase_04 AC 213 ms
79,104 KB
testcase_05 AC 192 ms
79,488 KB
testcase_06 AC 193 ms
79,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

def solve():
  n=int(input())
  cnt=[0]*n
  for i in range(n-1):
    a,b=map(lambda x:int(x)-1,input().split())
    cnt[a]+=1
    cnt[b]+=1
  one=cnt.count(1)
  if n-one<=one:
    print('Yes')
  else:
    print('No')

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