結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー shinichi
提出日時 2021-11-20 01:28:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 76,912 KB
最終ジャッジ日時 2025-01-02 05:16:22
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


N, M, T = map(int, input().split())
graph = defaultdict(list)
for _ in range(M):
    s, t = map(int, input().split())
    graph[s].append(t)
    graph[t].append(s)

cnt = [0] * N
new_cnt = [0] * N
cnt[0] = 1
mod = 998244353

while T > 0:
    new_cnt = [0] * N
    for s in range(N):
        for t in graph[s]:
            new_cnt[t] += cnt[s]
            new_cnt[t] %= mod
    cnt, new_cnt = new_cnt, cnt
    T -= 1
print(cnt[0])
0