結果

問題 No.1111 コード進行
ユーザー phsplsphspls
提出日時 2020-07-25 22:20:03
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,268 bytes
コンパイル時間 3,899 ms
コンパイル使用メモリ 146,968 KB
実行使用メモリ 217,088 KB
最終ジャッジ日時 2023-09-10 02:00:56
合計ジャッジ時間 6,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 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 1 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 5 ms
6,120 KB
testcase_07 AC 5 ms
5,600 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 7 ms
7,944 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 5 ms
6,132 KB
testcase_13 AC 4 ms
4,836 KB
testcase_14 AC 9 ms
8,528 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 6 ms
6,684 KB
testcase_17 AC 7 ms
8,232 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 9 ms
10,288 KB
testcase_23 AC 4 ms
4,564 KB
testcase_24 AC 4 ms
5,632 KB
testcase_25 AC 10 ms
9,820 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 106 ms
108,744 KB
testcase_29 AC 44 ms
45,492 KB
testcase_30 WA -
testcase_31 AC 12 ms
13,512 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 76 ms
78,432 KB
testcase_35 AC 96 ms
100,028 KB
testcase_36 AC 103 ms
107,472 KB
testcase_37 AC 27 ms
27,064 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 116 ms
120,376 KB
testcase_42 AC 48 ms
49,248 KB
testcase_43 WA -
testcase_44 AC 22 ms
23,812 KB
testcase_45 AC 71 ms
73,148 KB
testcase_46 WA -
testcase_47 AC 209 ms
217,088 KB
testcase_48 AC 2 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>() % DIVISOR);
}
0