結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー shinichishinichi
提出日時 2021-11-20 01:28:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 77,932 KB
最終ジャッジ日時 2023-08-30 14:22:49
合計ジャッジ時間 5,369 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,620 KB
testcase_01 AC 96 ms
71,476 KB
testcase_02 AC 94 ms
71,688 KB
testcase_03 AC 95 ms
71,796 KB
testcase_04 AC 127 ms
77,640 KB
testcase_05 AC 95 ms
71,536 KB
testcase_06 AC 105 ms
77,516 KB
testcase_07 AC 104 ms
77,776 KB
testcase_08 AC 94 ms
71,820 KB
testcase_09 AC 100 ms
77,084 KB
testcase_10 AC 116 ms
77,664 KB
testcase_11 AC 114 ms
77,720 KB
testcase_12 AC 161 ms
77,516 KB
testcase_13 AC 103 ms
77,696 KB
testcase_14 AC 116 ms
77,332 KB
testcase_15 AC 117 ms
77,488 KB
testcase_16 AC 121 ms
77,520 KB
testcase_17 AC 135 ms
77,752 KB
testcase_18 AC 164 ms
77,920 KB
testcase_19 AC 156 ms
77,668 KB
testcase_20 AC 108 ms
77,848 KB
testcase_21 AC 107 ms
77,864 KB
testcase_22 AC 92 ms
71,420 KB
testcase_23 AC 97 ms
77,300 KB
testcase_24 AC 98 ms
77,212 KB
testcase_25 AC 115 ms
77,856 KB
testcase_26 AC 114 ms
77,932 KB
testcase_27 AC 108 ms
77,536 KB
testcase_28 AC 124 ms
77,568 KB
testcase_29 AC 123 ms
77,756 KB
権限があれば一括ダウンロードができます

ソースコード

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