結果
| 問題 | No.3412 Christmas Tree Coloring |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-12-19 00:27:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 315 bytes |
| 記録 | |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 95,984 KB |
| 実行使用メモリ | 125,400 KB |
| 最終ジャッジ日時 | 2026-07-19 16:06:31 |
| 合計ジャッジ時間 | 7,111 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 5 |
ソースコード
from collections import defaultdict
MOD = 998244353
N = int(input())
adj = defaultdict(list)
for _ in range(N-1):
a, b = map(lambda x: int(x)-1, input().split())
adj[a].append(b)
adj[b].append(a)
ans = 0
for i in range(N):
nch = len(adj[i])
ans += pow(2, nch, MOD)
ans %= MOD
print(ans)
norioc