結果
| 問題 | No.1719 Tree and Permutation | 
| コンテスト | |
| ユーザー |  とりゐ | 
| 提出日時 | 2022-11-29 00:47:05 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 167 ms / 2,000 ms | 
| コード長 | 316 bytes | 
| コンパイル時間 | 243 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 79,656 KB | 
| 最終ジャッジ日時 | 2024-10-06 03:53:22 | 
| 合計ジャッジ時間 | 2,515 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 6 | 
ソースコード
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()
            
            
            
        