結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-09-18 18:50:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 295 bytes |
| コンパイル時間 | 158 ms |
| コンパイル使用メモリ | 81,804 KB |
| 実行使用メモリ | 95,172 KB |
| 最終ジャッジ日時 | 2024-09-18 18:50:48 |
| 合計ジャッジ時間 | 5,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 27 |
ソースコード
n=int(input()) e=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1 b-=1 e[a]+=[b] e[b]+=[a] v=[0]*n f=[1]*n q=[0] while len(q)>0: s=q[-1] if v[s]==0: v[s]=1 for t in e[s]: if v[t]==0: q+=[t] f[t]=0 else: q.pop() print(sum(f)+(len(e[0])==0)-2)
sasa8uyauya