結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー kokatsukokatsu
提出日時 2021-11-19 23:36:25
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 3,112 ms
コンパイル使用メモリ 202,080 KB
実行使用メモリ 12,348 KB
最終ジャッジ日時 2023-09-04 15:01:43
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 6 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 5 ms
11,600 KB
testcase_11 AC 6 ms
12,348 KB
testcase_12 AC 12 ms
11,856 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 4 ms
4,384 KB
testcase_17 AC 8 ms
6,692 KB
testcase_18 AC 11 ms
11,340 KB
testcase_19 AC 11 ms
9,876 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 5 ms
9,008 KB
testcase_26 AC 2 ms
5,600 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 6 ms
4,380 KB
testcase_29 AC 6 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

struct Path {
    long from;
    long to;
}

void main() {
    long N, M, T;
    readf("%d %d %d\n", N, M, T);

    auto path = new Path[](M);
    foreach (i; 0 .. M) {
        long s, t;
        readf("%d %d\n", s, t);

        path[i] = Path(s, t);
    }

    enum long MOD = 998244353;

    auto dp = new long[][](T+1, N);
    dp[0][0] = 1;
    foreach (i; 0 .. T) {
        foreach (p; path) {
            dp[i+1][p.to] = (dp[i+1][p.to] + dp[i][p.from]) % MOD;
            dp[i+1][p.from] = (dp[i+1][p.from] + dp[i][p.to]) % MOD;
        }
    }

    long res = dp[T][0];
    res.writeln;
}
0