結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 4 ms
5,884 KB
testcase_07 WA -
testcase_08 AC 5 ms
6,660 KB
testcase_09 AC 3 ms
4,680 KB
testcase_10 AC 4 ms
5,548 KB
testcase_11 AC 4 ms
5,436 KB
testcase_12 WA -
testcase_13 AC 4 ms
5,316 KB
testcase_14 WA -
testcase_15 AC 6 ms
6,960 KB
testcase_16 WA -
testcase_17 AC 3 ms
4,720 KB
testcase_18 AC 2 ms
4,684 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 3 ms
4,860 KB
testcase_22 AC 5 ms
6,520 KB
testcase_23 AC 5 ms
6,268 KB
testcase_24 AC 3 ms
4,748 KB
testcase_25 WA -
testcase_26 AC 4 ms
5,560 KB
testcase_27 AC 3 ms
4,504 KB
testcase_28 AC 7 ms
7,396 KB
testcase_29 AC 17 ms
17,408 KB
testcase_30 AC 16 ms
13,912 KB
testcase_31 AC 3 ms
4,824 KB
testcase_32 AC 27 ms
20,080 KB
testcase_33 AC 20 ms
13,532 KB
testcase_34 AC 6 ms
7,080 KB
testcase_35 AC 9 ms
9,804 KB
testcase_36 AC 130 ms
108,252 KB
testcase_37 AC 98 ms
89,788 KB
testcase_38 AC 50 ms
45,656 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 29 ms
26,936 KB
testcase_42 AC 108 ms
96,504 KB
testcase_43 AC 64 ms
55,116 KB
testcase_44 AC 32 ms
31,408 KB
testcase_45 AC 54 ms
49,956 KB
testcase_46 AC 19 ms
19,064 KB
testcase_47 AC 63 ms
19,740 KB
testcase_48 AC 231 ms
222,556 KB
testcase_49 AC 227 ms
222,608 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,300){
    ans += dp[n-1][i][k];
    ans%=MOD;
  }
  cout << ans << endl; 
  return 0;
}
0