結果

問題 No.1111 コード進行
ユーザー cumincumin
提出日時 2020-08-04 15:51:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,102 bytes
コンパイル時間 1,595 ms
コンパイル使用メモリ 164,468 KB
実行使用メモリ 222,600 KB
最終ジャッジ日時 2023-10-12 18:57:04
合計ジャッジ時間 4,780 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 3 ms
4,352 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 5 ms
5,888 KB
testcase_07 WA -
testcase_08 AC 6 ms
6,676 KB
testcase_09 AC 3 ms
4,624 KB
testcase_10 AC 4 ms
5,572 KB
testcase_11 AC 4 ms
5,428 KB
testcase_12 WA -
testcase_13 AC 4 ms
5,356 KB
testcase_14 WA -
testcase_15 AC 5 ms
6,976 KB
testcase_16 WA -
testcase_17 AC 3 ms
4,640 KB
testcase_18 AC 3 ms
4,592 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 3 ms
4,448 KB
testcase_21 AC 3 ms
4,912 KB
testcase_22 AC 5 ms
6,488 KB
testcase_23 AC 5 ms
6,188 KB
testcase_24 AC 3 ms
4,672 KB
testcase_25 WA -
testcase_26 AC 4 ms
5,480 KB
testcase_27 AC 3 ms
4,364 KB
testcase_28 AC 7 ms
7,444 KB
testcase_29 AC 18 ms
17,420 KB
testcase_30 AC 17 ms
13,768 KB
testcase_31 AC 3 ms
4,812 KB
testcase_32 AC 26 ms
19,992 KB
testcase_33 AC 21 ms
13,484 KB
testcase_34 AC 6 ms
6,856 KB
testcase_35 AC 10 ms
9,892 KB
testcase_36 AC 131 ms
108,316 KB
testcase_37 AC 100 ms
89,768 KB
testcase_38 AC 51 ms
45,596 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 29 ms
26,660 KB
testcase_42 AC 110 ms
96,672 KB
testcase_43 AC 64 ms
55,040 KB
testcase_44 AC 33 ms
31,632 KB
testcase_45 AC 54 ms
49,940 KB
testcase_46 AC 20 ms
19,172 KB
testcase_47 AC 63 ms
19,784 KB
testcase_48 AC 230 ms
222,600 KB
testcase_49 AC 225 ms
222,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const int MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

int n,m,k;
ll dp[310][310][310];
int p[300],q[300],c[300];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  cin >> n >> m >> k;
  rep(i,m){
    cin >> p[i] >> q[i] >> c[i];
    p[i]--;
    q[i]--;
  }
  memset(dp,sizeof(dp),0);
  rep(i,300) dp[0][i][0] = 1;
  
  rep(i,n){
    rep(j,m){
      rep(l,k+1){
      	dp[i+1][q[j]][l+c[j]]+=dp[i][p[j]][l];
        dp[i+1][q[j]][l+c[j]]%=MOD;
      }
    }
  }
  ll ans = 0;
  rep(i,300){
    ans += dp[n-1][i][k];
    ans%=MOD;
  }
  cout << ans << endl; 
  return 0;
}
0