結果
| 問題 | No.3412 Christmas Tree Coloring |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-12-19 00:27:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 315 bytes |
| 記録 | |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 82,668 KB |
| 実行使用メモリ | 119,388 KB |
| 最終ジャッジ日時 | 2025-12-19 00:27:18 |
| 合計ジャッジ時間 | 7,488 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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