結果

問題 No.1111 コード進行
ユーザー umezoumezo
提出日時 2020-07-10 23:12:04
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 832 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 200,368 KB
実行使用メモリ 216,472 KB
最終ジャッジ日時 2024-04-19 23:34:08
合計ジャッジ時間 4,642 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 4 ms
6,400 KB
testcase_06 AC 4 ms
8,320 KB
testcase_07 AC 5 ms
7,424 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 5 ms
9,856 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 6 ms
8,064 KB
testcase_13 AC 4 ms
6,784 KB
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 6 ms
8,704 KB
testcase_17 AC 5 ms
10,348 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 4 ms
6,144 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 7 ms
12,320 KB
testcase_23 AC 4 ms
6,400 KB
testcase_24 AC 4 ms
7,480 KB
testcase_25 AC 7 ms
11,648 KB
testcase_26 AC 5 ms
7,936 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 AC 60 ms
109,756 KB
testcase_29 AC 21 ms
46,848 KB
testcase_30 AC 37 ms
73,744 KB
testcase_31 AC 8 ms
15,444 KB
testcase_32 AC 37 ms
65,664 KB
testcase_33 AC 31 ms
44,240 KB
testcase_34 AC 34 ms
79,592 KB
testcase_35 AC 54 ms
100,772 KB
testcase_36 AC 124 ms
108,416 KB
testcase_37 AC 23 ms
28,588 KB
testcase_38 AC 17 ms
21,912 KB
testcase_39 AC 51 ms
72,688 KB
testcase_40 AC 67 ms
99,328 KB
testcase_41 AC 68 ms
121,216 KB
testcase_42 AC 37 ms
50,416 KB
testcase_43 AC 33 ms
44,544 KB
testcase_44 AC 14 ms
25,216 KB
testcase_45 AC 38 ms
74,368 KB
testcase_46 AC 4 ms
5,376 KB
testcase_47 AC 222 ms
216,472 KB
testcase_48 AC 4 ms
5,376 KB
testcase_49 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const ll MOD=1e9+7;

int main(){
  ll n,m,K;
  cin>>n>>m>>K;
  
  ll dp[n+1][301][K+1];
  rep(i,n+1){
    rep(j,301){
      rep(k,K+1) dp[i][j][k]=0;
    }
  }
    
  vector<pair<ll,ll>> A[301];
  ll p,q,c;
  rep(i,m){
    cin>>p>>q>>c;
    A[p].push_back({q,c});
    dp[2][q][c]++;
  } 
  
  for(int i=2;i<=n-1;i++){
    for(int j=1;j<=300;j++){
      for(int k=0;k<=K;k++){
        for(auto x:A[j]){
          if(k+x.second>K) continue;
          dp[i+1][x.first][k+x.second]=(dp[i+1][x.first][k+x.second]+dp[i][j][k])%MOD;
        }
      }
    }
  }
        
  ll ans=0;
  for(int j=1;j<=300;j++){
    ans=(ans+dp[n][j][K])%MOD;
  }
  
  cout<<ans<<endl;
  
  return 0;
}
0