結果

問題 No.1111 コード進行
ユーザー onsen_manjuuuonsen_manjuuu
提出日時 2020-07-12 03:38:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 926 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 174,460 KB
実行使用メモリ 218,496 KB
最終ジャッジ日時 2024-04-21 21:25:39
合計ジャッジ時間 5,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 3 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 7 ms
7,424 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 10 ms
9,728 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 7 ms
6,656 KB
testcase_14 WA -
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 9 ms
8,704 KB
testcase_17 AC 9 ms
10,112 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 5 ms
5,632 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 12 ms
12,288 KB
testcase_23 AC 6 ms
6,400 KB
testcase_24 AC 7 ms
7,296 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 4 ms
5,376 KB
testcase_28 AC 114 ms
110,848 KB
testcase_29 AC 56 ms
48,000 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 85 ms
80,768 KB
testcase_35 AC 111 ms
103,296 KB
testcase_36 AC 152 ms
109,440 KB
testcase_37 AC 49 ms
29,568 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 130 ms
123,136 KB
testcase_42 AC 78 ms
51,712 KB
testcase_43 WA -
testcase_44 AC 33 ms
26,240 KB
testcase_45 AC 90 ms
75,776 KB
testcase_46 AC 11 ms
8,704 KB
testcase_47 AC 292 ms
218,496 KB
testcase_48 AC 12 ms
8,448 KB
testcase_49 AC 12 ms
8,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

int main()
{
    int n, m, k; cin >> n >> m >> k;
    vector<vector<pair<int,int>>> a(300);
    for(int i = 0; i < m; i++) {
        int p, q, c; cin >> p >> q >> c; p--, q--;
        a[p].push_back({q, c});
    }

    vector<vector<vector<ll>>> dp(n, vector<vector<ll>>(300, vector<ll>(k + 1)));
    for(int i = 0; i < n; i++)dp[0][i][0] = 1;

    for(int i = 0; i < n - 1; i++) {
        for(int j = 0; j < 300; j++) {

            for(auto p : a[j]) {
                for(int t = 0; t <= k; t++) {
                    if(p.second + t > k)break;
                    dp[i + 1][p.first][t + p.second] += dp[i][j][t];
                    dp[i + 1][p.first][t + p.second] %= mod;
                }
            }


        }
    }
    ll sum = 0;
    for(int i = 0; i < 300; i++)sum += dp[n - 1][i][k];
    cout << sum % mod << endl;

}
0