結果
| 問題 |
No.2427 Tree Distance Two
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-06-01 20:16:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 702 ms / 2,000 ms |
| コード長 | 238 bytes |
| コンパイル時間 | 357 ms |
| コンパイル使用メモリ | 82,224 KB |
| 実行使用メモリ | 125,932 KB |
| 最終ジャッジ日時 | 2024-12-22 09:08:39 |
| 合計ジャッジ時間 | 13,503 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
N=int(input())
graph=[[] for x in range(N)]
for i in range(N-1):
u,v=map(int,input().split())
u-=1;v-=1
graph[u].append(v)
graph[v].append(u)
for x in range(N):
ans=sum(len(graph[y])-1 for y in graph[x])
print(ans)
vwxyz