結果

問題 No.1111 コード進行
ユーザー phsplsphspls
提出日時 2020-07-25 22:11:11
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,258 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 144,212 KB
実行使用メモリ 217,036 KB
最終ジャッジ日時 2023-09-10 01:45:23
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 5 ms
6,160 KB
testcase_07 AC 4 ms
5,584 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 7 ms
8,012 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 6 ms
6,148 KB
testcase_13 AC 4 ms
4,828 KB
testcase_14 AC 9 ms
8,524 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 5 ms
6,676 KB
testcase_17 AC 8 ms
8,264 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 3 ms
4,504 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 9 ms
10,372 KB
testcase_23 AC 4 ms
4,676 KB
testcase_24 AC 4 ms
5,536 KB
testcase_25 AC 10 ms
9,836 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 101 ms
108,852 KB
testcase_29 AC 42 ms
45,484 KB
testcase_30 WA -
testcase_31 AC 13 ms
13,524 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 72 ms
78,484 KB
testcase_35 AC 94 ms
100,076 KB
testcase_36 AC 99 ms
107,528 KB
testcase_37 AC 26 ms
27,080 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 111 ms
120,372 KB
testcase_42 AC 46 ms
49,236 KB
testcase_43 WA -
testcase_44 AC 22 ms
23,788 KB
testcase_45 AC 67 ms
73,168 KB
testcase_46 WA -
testcase_47 AC 200 ms
217,036 KB
testcase_48 AC 3 ms
4,376 KB
testcase_49 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut nmk = String::new();
    std::io::stdin().read_line(&mut nmk).ok();
    let nmk: Vec<usize> = nmk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nmk[0];
    let m = nmk[1];
    let k = nmk[2];
    let mut progress: Vec<Vec<(usize, usize)>> = vec![vec![]; 300];
    for _ in 0..m {
        let mut pqc = String::new();
        std::io::stdin().read_line(&mut pqc).ok();
        let pqc: Vec<usize> = pqc.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
        progress[pqc[0] - 1].push((pqc[1] - 1, pqc[2]));
    }

    const DIVISOR: usize = 10e9 as usize + 7usize;
    let mut dp: Vec<Vec<Vec<usize>>> = vec![vec![vec![0; 300]; k+1]; n];
    for i in 0..300 {
        dp[0][0][i] = 1;
    }
    for i in 1..n {
        for c in 0..=k {
            for m in 0..300 {
                if dp[i-1][c][m] == 0 { continue; }
                progress[m].iter()
                    .filter(|&pair| pair.1 + c <= k)
                    .for_each(|&pair| {
                        dp[i][c + pair.1][pair.0] += dp[i-1][c][m];
                        dp[i][c + pair.1][pair.0] %= DIVISOR;
                    });
            }
        }
    }
    println!("{}", dp[n-1][k].iter().sum::<usize>());
}
0