結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー phsplsphspls
提出日時 2022-10-17 23:26:19
言語 Rust
(1.77.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 890 bytes
コンパイル時間 5,111 ms
コンパイル使用メモリ 141,924 KB
実行使用メモリ 9,784 KB
最終ジャッジ日時 2023-09-10 21:13:36
合計ジャッジ時間 3,758 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

const MOD: usize = 998244353;

fn main() {
    let mut nmt = String::new();
    std::io::stdin().read_line(&mut nmt).ok();
    let nmt: Vec<usize> = nmt.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nmt[0];
    let m = nmt[1];
    let t = nmt[2];
    let lines = (0..m).map(|_| {
            let mut temp = String::new();
            std::io::stdin().read_line(&mut temp).ok();
            let temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
            (temp[0], temp[1])
        })
        .collect::<Vec<_>>();

    let mut dp = vec![vec![0usize; n]; t+1];
    dp[0][0] = 1;
    for i in 0..t {
        for &(s, t) in lines.iter() {
            dp[i+1][s] += dp[i][t];
            dp[i+1][t] += dp[i][s];
            dp[i+1][s] %= MOD;
            dp[i+1][t] %= MOD;
        }
    }
    println!("{}", dp[t][0]);
}
0