結果

問題 No.1111 コード進行
ユーザー trineutrontrineutron
提出日時 2019-11-01 02:54:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,193 bytes
コンパイル時間 2,201 ms
コンパイル使用メモリ 177,624 KB
実行使用メモリ 117,280 KB
最終ジャッジ日時 2024-04-09 05:09:28
合計ジャッジ時間 10,909 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 234 ms
7,040 KB
testcase_08 AC 71 ms
6,944 KB
testcase_09 WA -
testcase_10 AC 402 ms
9,600 KB
testcase_11 AC 72 ms
6,948 KB
testcase_12 WA -
testcase_13 AC 159 ms
6,944 KB
testcase_14 WA -
testcase_15 AC 47 ms
6,944 KB
testcase_16 AC 279 ms
8,064 KB
testcase_17 AC 427 ms
9,728 KB
testcase_18 AC 75 ms
6,944 KB
testcase_19 AC 3 ms
6,944 KB
testcase_20 AC 74 ms
6,944 KB
testcase_21 AC 9 ms
6,944 KB
testcase_22 AC 552 ms
11,776 KB
testcase_23 AC 169 ms
6,944 KB
testcase_24 AC 210 ms
6,948 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 28 ms
6,944 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    const long mod = 1000000007;
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> p(m), q(m), c(m);
    vector<vector<bool>> ac(300, vector<bool>(300));
    for (int i = 0; i < m; i++) {
        cin >> p.at(i) >> q.at(i) >> c.at(i);
        p.at(i)--; q.at(i)--;
        ac.at(p.at(i)).at(q.at(i)) = true;
    }
    vector<vector<vector<long>>> dp(n - 1, vector<vector<long>>(300, vector<long>(k + 1)));
    for (int i = 0; i < m; i++) {
        if (c.at(i) <= k) dp.at(0).at(q.at(i)).at(c.at(i))++;
    }
    for (int i = 1; i < n - 1; i++) {
        for (int j = 0; j < 300; j++) {
            for (int comp = 0; comp <= k; comp++) {
                for (int l = 0; l < 300; l++) {
                    if (ac.at(j).at(l) && j < c.size() && comp >= c.at(j)) {
                        dp.at(i).at(l).at(comp) += dp.at(i - 1).at(j).at(comp - c.at(j));
                        dp.at(i).at(l).at(comp) %= mod;
                    }
                }
            }
        }
    }
    long ans = 0;
    for (int i = 0; i < 300; i++) {
        ans += dp.at(n - 2).at(i).at(k);
        ans %= mod;
    }
    cout << ans << endl;
}
0