結果

問題 No.1111 コード進行
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-11 01:22:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 998 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 98,032 KB
実行使用メモリ 218,984 KB
最終ジャッジ日時 2023-08-02 03:09:26
合計ジャッジ時間 5,133 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,404 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 4 ms
5,268 KB
testcase_07 AC 5 ms
5,456 KB
testcase_08 AC 8 ms
6,560 KB
testcase_09 AC 3 ms
4,440 KB
testcase_10 AC 4 ms
5,004 KB
testcase_11 AC 4 ms
5,168 KB
testcase_12 AC 5 ms
4,944 KB
testcase_13 AC 3 ms
5,032 KB
testcase_14 AC 6 ms
5,232 KB
testcase_15 AC 6 ms
7,080 KB
testcase_16 AC 6 ms
5,808 KB
testcase_17 AC 3 ms
4,552 KB
testcase_18 AC 3 ms
4,524 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 4 ms
4,832 KB
testcase_22 AC 5 ms
6,096 KB
testcase_23 AC 5 ms
5,996 KB
testcase_24 AC 2 ms
4,444 KB
testcase_25 AC 11 ms
7,644 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 7 ms
7,248 KB
testcase_29 AC 24 ms
20,780 KB
testcase_30 WA -
testcase_31 AC 3 ms
4,828 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 6 ms
6,956 KB
testcase_35 AC 12 ms
10,744 KB
testcase_36 AC 174 ms
109,508 KB
testcase_37 AC 170 ms
103,284 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 33 ms
27,860 KB
testcase_42 AC 166 ms
106,076 KB
testcase_43 WA -
testcase_44 AC 51 ms
38,712 KB
testcase_45 AC 72 ms
55,956 KB
testcase_46 WA -
testcase_47 AC 103 ms
19,488 KB
testcase_48 AC 382 ms
218,984 KB
testcase_49 AC 381 ms
218,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
const int inf = (int)1e9;

ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 
 
ll dp[305][305][305];
 
 
int main(void){
	int n,m,k;
	cin>>n>>m>>k;
	vector<int>P(m),Q(m),C(m);
	for(int i=0;i<m;i++)cin>>P[i]>>Q[i]>>C[i];
	for(int i=1;i<=300;i++)dp[0][i][0]=1;
	for(int i=0;i<n-1;i++){
		for(int x=0;x<=300;x++){
			for(int j=0;j<m;j++){
				if(x>=C[j])dp[i+1][Q[j]][x]=(dp[i+1][Q[j]][x]+dp[i][P[j]][x-C[j]])%N;
			}
		}
	}
	ll ans = 0;
	for(int i=1;i<=300;i++){
		ans = (ans+dp[n-1][i][k]);
	}
	cout<<ans<<endl;
    return 0;
}
0