結果

問題 No.1111 コード進行
ユーザー yuji9511yuji9511
提出日時 2020-07-10 22:11:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 1,338 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 195,888 KB
実行使用メモリ 222,080 KB
最終ジャッジ日時 2024-04-19 17:23:29
合計ジャッジ時間 4,290 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,948 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 3 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 3 ms
6,944 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 AC 2 ms
6,948 KB
testcase_25 AC 6 ms
8,376 KB
testcase_26 AC 4 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 6 ms
7,296 KB
testcase_29 AC 16 ms
17,280 KB
testcase_30 AC 15 ms
14,432 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 25 ms
18,560 KB
testcase_33 AC 21 ms
12,544 KB
testcase_34 AC 5 ms
6,944 KB
testcase_35 AC 8 ms
9,856 KB
testcase_36 AC 125 ms
107,904 KB
testcase_37 AC 91 ms
89,632 KB
testcase_38 AC 47 ms
45,792 KB
testcase_39 AC 42 ms
27,732 KB
testcase_40 AC 97 ms
85,504 KB
testcase_41 AC 26 ms
26,368 KB
testcase_42 AC 99 ms
96,128 KB
testcase_43 AC 60 ms
54,528 KB
testcase_44 AC 28 ms
32,276 KB
testcase_45 AC 49 ms
49,792 KB
testcase_46 AC 17 ms
19,456 KB
testcase_47 AC 84 ms
19,712 KB
testcase_48 AC 202 ms
222,080 KB
testcase_49 AC 151 ms
163,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll dp[310][310][310] = {};


void solve(){
    ll N,M,K;
    cin >> N >> M >> K;
    ll P[310], Q[310], C[310];
    ll dist[310][310] = {};
    rep(i,0,300){
        rep(j,0,300){
            if(i == j) dist[i][j] = 0;
            else dist[i][j] = INF;
        }
    }
    rep(i,0,M){
        cin >> P[i] >> Q[i] >> C[i];
        P[i]--; Q[i]--;
        dist[P[i]][Q[i]] = C[i];
    }

    
    rep(i,0,300){
        dp[0][i][0] = 1;
    }
    rep(n,0,N-1){
        rep(i,0,M){
            rep(k,0,K+1){
                if(k - C[i] >= 0){
                    dp[n+1][Q[i]][k] += dp[n][P[i]][k - C[i]];
                    dp[n+1][Q[i]][k] %= MOD;
                }
            }
        }
    }
    ll ans = 0;
    rep(i,0,300){
        ans += dp[N-1][i][K];
        ans %= MOD;
    }
    print(ans);

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}
0