結果

問題 No.1111 コード進行
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-11 01:24:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 998 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 99,680 KB
実行使用メモリ 219,256 KB
最終ジャッジ日時 2024-04-20 03:29:48
合計ジャッジ時間 3,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 5 ms
6,940 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 6 ms
7,296 KB
testcase_16 AC 4 ms
6,944 KB
testcase_17 AC 3 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,948 KB
testcase_21 AC 3 ms
6,944 KB
testcase_22 AC 4 ms
6,944 KB
testcase_23 AC 4 ms
6,944 KB
testcase_24 AC 3 ms
6,940 KB
testcase_25 AC 7 ms
7,808 KB
testcase_26 WA -
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 6 ms
7,680 KB
testcase_29 AC 20 ms
20,992 KB
testcase_30 WA -
testcase_31 AC 3 ms
6,944 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 6 ms
7,296 KB
testcase_35 AC 11 ms
11,008 KB
testcase_36 AC 134 ms
109,568 KB
testcase_37 AC 123 ms
103,424 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 28 ms
28,288 KB
testcase_42 AC 123 ms
106,368 KB
testcase_43 WA -
testcase_44 AC 39 ms
38,784 KB
testcase_45 AC 57 ms
56,064 KB
testcase_46 WA -
testcase_47 AC 83 ms
19,712 KB
testcase_48 AC 271 ms
219,256 KB
testcase_49 AC 269 ms
219,136 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 j=0;j<m;j++){
			for(int x=0;x<=300;x++){
				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