結果

問題 No.1111 コード進行
ユーザー auauaauaua
提出日時 2020-07-10 22:19:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 1,060 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 172,448 KB
実行使用メモリ 219,904 KB
最終ジャッジ日時 2024-04-19 17:30:52
合計ジャッジ時間 4,756 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 4 ms
6,784 KB
testcase_06 AC 6 ms
8,704 KB
testcase_07 AC 5 ms
7,680 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 4 ms
6,944 KB
testcase_10 AC 6 ms
10,240 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 6 ms
8,448 KB
testcase_13 AC 4 ms
7,040 KB
testcase_14 AC 8 ms
10,880 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 7 ms
9,088 KB
testcase_17 AC 7 ms
10,496 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 3 ms
6,400 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 9 ms
12,800 KB
testcase_23 AC 4 ms
6,656 KB
testcase_24 AC 4 ms
7,808 KB
testcase_25 AC 9 ms
12,032 KB
testcase_26 AC 6 ms
7,936 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 AC 77 ms
111,872 KB
testcase_29 AC 36 ms
48,384 KB
testcase_30 AC 59 ms
75,392 KB
testcase_31 AC 9 ms
15,872 KB
testcase_32 AC 61 ms
67,840 KB
testcase_33 AC 47 ms
45,440 KB
testcase_34 AC 56 ms
81,536 KB
testcase_35 AC 73 ms
103,936 KB
testcase_36 AC 167 ms
110,464 KB
testcase_37 AC 36 ms
29,824 KB
testcase_38 AC 27 ms
22,784 KB
testcase_39 AC 86 ms
74,112 KB
testcase_40 AC 144 ms
101,760 KB
testcase_41 AC 93 ms
123,904 KB
testcase_42 AC 64 ms
52,352 KB
testcase_43 AC 62 ms
46,208 KB
testcase_44 AC 23 ms
26,624 KB
testcase_45 AC 66 ms
76,416 KB
testcase_46 AC 8 ms
8,576 KB
testcase_47 AC 236 ms
219,904 KB
testcase_48 AC 9 ms
8,576 KB
testcase_49 AC 8 ms
8,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n,m,k;cin>>n>>m>>k;
    vector<vector<vector<ll> > >dp(n+1,vector<vector<ll> >(301,vector<ll>(k+1)));
    rep(i,301){
        dp[0][i][0]=1;
    }
    vector<pair<pll,ll> >a(m);
    rep(i,m){
        ll p,q,c;cin>>p>>q>>c;
        a[i]=mp(mp(p,q),c);
    }
    rep(i,n-1){
        rep(j,k+1){
            rep(l,m){
                ll p=a[l].first.first;
                ll q=a[l].first.second;
                ll c=a[l].second;
                if(j+c>k)continue;
                dp[i+1][q][j+c]=(dp[i+1][q][j+c]+dp[i][p][j])%inf;
            }
        }
    }
    ll ans=0;
    rep(i,301){
        ans=(ans+dp[n-1][i][k])%inf;
    }
    cout<<ans<<endl;
}
0