結果

問題 No.1111 コード進行
ユーザー ShibuyapShibuyap
提出日時 2020-08-06 04:29:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 2,608 ms
コンパイル使用メモリ 202,600 KB
実行使用メモリ 109,816 KB
最終ジャッジ日時 2023-10-19 05:54:35
合計ジャッジ時間 5,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,704 KB
testcase_06 AC 4 ms
5,712 KB
testcase_07 AC 3 ms
5,476 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 3 ms
4,836 KB
testcase_10 AC 4 ms
6,668 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 4 ms
5,704 KB
testcase_13 AC 3 ms
5,116 KB
testcase_14 AC 5 ms
6,876 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 4 ms
6,016 KB
testcase_17 AC 4 ms
6,836 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,604 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 4 ms
7,840 KB
testcase_23 AC 3 ms
5,000 KB
testcase_24 AC 4 ms
5,432 KB
testcase_25 AC 6 ms
7,516 KB
testcase_26 AC 4 ms
5,672 KB
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 20 ms
56,468 KB
testcase_29 AC 11 ms
25,156 KB
testcase_30 AC 17 ms
38,448 KB
testcase_31 AC 5 ms
9,340 KB
testcase_32 AC 20 ms
34,596 KB
testcase_33 AC 19 ms
23,744 KB
testcase_34 AC 14 ms
41,384 KB
testcase_35 AC 19 ms
52,064 KB
testcase_36 AC 41 ms
55,784 KB
testcase_37 AC 13 ms
16,016 KB
testcase_38 AC 11 ms
12,740 KB
testcase_39 AC 28 ms
37,968 KB
testcase_40 AC 34 ms
51,252 KB
testcase_41 AC 23 ms
62,192 KB
testcase_42 AC 21 ms
27,004 KB
testcase_43 AC 21 ms
24,020 KB
testcase_44 AC 9 ms
14,436 KB
testcase_45 AC 19 ms
38,820 KB
testcase_46 AC 3 ms
4,348 KB
testcase_47 AC 85 ms
109,816 KB
testcase_48 AC 3 ms
4,348 KB
testcase_49 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("YES");}else{puts("NO");}
#define MAX_N 200005

int main() {
    int n, m, K;
    cin >> n >> m >> K;
    int p[m], q[m], c[m];
    rep(i,m) cin >> p[i] >> q[i] >> c[i];
    int dp[n][301][K+1];
    rep(i,n)rep(j,301)rep(k,K+1)dp[i][j][k] = 0;
    rep(j,301) dp[0][j][0] = 1;
    ll MOD = 1000000007;
    rep(i,n-1){
        rep(j,m){
            rep(k,K+1){
                if(k+c[j]>K)break;
                dp[i+1][q[j]][k+c[j]] += dp[i][p[j]][k];
                dp[i+1][q[j]][k+c[j]] %= MOD;
            }
        }
    }
    ll ans = 0;
    rep(j,301){
        ans += dp[n-1][j][K];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}
 
 
0