結果
| 問題 |
No.3373 Partial Complement Tree
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-10-30 21:04:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 485 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 83,036 KB |
| 実行使用メモリ | 125,180 KB |
| 最終ジャッジ日時 | 2025-11-21 20:52:10 |
| 合計ジャッジ時間 | 9,457 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 WA * 3 |
ソースコード
# 想定不正解:mod取り忘れ
def solve():
N = int(input())
edges = []
graph = [[] for _ in range(N)]
for _ in range(N - 1):
U, V = [int(x) - 1 for x in input().split()]
edges.append((U, V))
graph[U].append(V)
graph[V].append(U)
ans = 0
for u, v in edges:
ans += (len(graph[u]) - 1) * (len(graph[v]) - 1)
print(ans)
if __name__ == "__main__":
T = int(input())
for _ in range(T):
solve()