結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 3 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 4 ms
5,880 KB
testcase_07 WA -
testcase_08 AC 6 ms
6,660 KB
testcase_09 AC 3 ms
4,736 KB
testcase_10 AC 4 ms
5,340 KB
testcase_11 AC 4 ms
5,372 KB
testcase_12 WA -
testcase_13 AC 4 ms
5,380 KB
testcase_14 WA -
testcase_15 AC 5 ms
7,000 KB
testcase_16 WA -
testcase_17 AC 3 ms
4,760 KB
testcase_18 AC 2 ms
4,664 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 3 ms
4,352 KB
testcase_21 AC 3 ms
4,920 KB
testcase_22 AC 5 ms
6,560 KB
testcase_23 AC 5 ms
6,252 KB
testcase_24 AC 3 ms
4,736 KB
testcase_25 WA -
testcase_26 AC 5 ms
5,500 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 7 ms
7,444 KB
testcase_29 AC 18 ms
17,424 KB
testcase_30 AC 17 ms
13,780 KB
testcase_31 AC 3 ms
4,980 KB
testcase_32 AC 27 ms
19,952 KB
testcase_33 AC 21 ms
13,580 KB
testcase_34 AC 6 ms
6,996 KB
testcase_35 AC 9 ms
9,616 KB
testcase_36 AC 125 ms
108,596 KB
testcase_37 AC 96 ms
89,988 KB
testcase_38 AC 49 ms
45,716 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 29 ms
26,728 KB
testcase_42 AC 106 ms
96,552 KB
testcase_43 AC 63 ms
54,976 KB
testcase_44 AC 32 ms
31,516 KB
testcase_45 AC 53 ms
49,996 KB
testcase_46 AC 19 ms
19,124 KB
testcase_47 AC 64 ms
20,008 KB
testcase_48 AC 233 ms
222,740 KB
testcase_49 AC 226 ms
222,544 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,301) 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,301){
    ans += dp[n-1][i][k];
    ans%=MOD;
  }
  cout << ans << endl; 
  return 0;
}
0