結果
| 問題 | No.806 木を道に |
| コンテスト | |
| ユーザー |
maburoe
|
| 提出日時 | 2019-05-17 15:36:22 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 276 ms / 2,000 ms |
| コード長 | 425 bytes |
| 記録 | |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 15,836 KB |
| 最終ジャッジ日時 | 2026-04-06 03:30:55 |
| 合計ジャッジ時間 | 6,141 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
node_num = int(input())
nodes_count = [0] * node_num
answer = 0
for i in range(node_num - 1):
first, second = map(int, input().split())
firstIndex = first - 1
secondIndex = second - 1
if nodes_count[firstIndex] == 2:
answer += 1
else:
nodes_count[firstIndex] += 1
if nodes_count[secondIndex] == 2:
answer += 1
else:
nodes_count[secondIndex] += 1
print(answer)
maburoe