結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ygd.ygd.
提出日時 2021-11-21 12:39:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-09-04 21:23:20
合計ジャッジ時間 3,740 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,952 KB
testcase_01 AC 18 ms
7,784 KB
testcase_02 AC 16 ms
7,996 KB
testcase_03 AC 16 ms
7,836 KB
testcase_04 AC 236 ms
7,784 KB
testcase_05 AC 16 ms
7,788 KB
testcase_06 AC 17 ms
7,868 KB
testcase_07 AC 16 ms
7,916 KB
testcase_08 AC 16 ms
7,872 KB
testcase_09 AC 16 ms
7,944 KB
testcase_10 AC 78 ms
7,804 KB
testcase_11 AC 79 ms
7,928 KB
testcase_12 AC 281 ms
8,304 KB
testcase_13 AC 17 ms
7,972 KB
testcase_14 AC 30 ms
7,800 KB
testcase_15 AC 68 ms
7,792 KB
testcase_16 AC 108 ms
7,788 KB
testcase_17 AC 241 ms
7,972 KB
testcase_18 AC 312 ms
8,224 KB
testcase_19 AC 209 ms
8,416 KB
testcase_20 AC 25 ms
7,880 KB
testcase_21 AC 22 ms
7,864 KB
testcase_22 AC 16 ms
7,868 KB
testcase_23 AC 17 ms
7,852 KB
testcase_24 AC 17 ms
7,784 KB
testcase_25 AC 69 ms
8,336 KB
testcase_26 AC 33 ms
7,928 KB
testcase_27 AC 26 ms
7,784 KB
testcase_28 AC 236 ms
7,784 KB
testcase_29 AC 223 ms
7,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline


def main():
    N,M,T = map(int,input().split()); MOD = 998244353
    G =[[] for _ in range(N)]
    for i in range(M):
        a,b = map(int,input().split())
        G[a].append(b)
        G[b].append(a)
    
    dp = [0]*N
    dp[0] = 1
    for i in range(T):
        p = [0]*N
        p,dp = dp,p
        for v in range(N):
            for u in G[v]:
                dp[v] += p[u]
                dp[v] %= MOD
    ans = dp[0]%MOD
    print(ans)
        

if __name__ == '__main__':
    main()
0