結果

問題 No.1111 コード進行
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-11 01:24:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 1,001 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 100,188 KB
実行使用メモリ 219,184 KB
最終ジャッジ日時 2024-04-20 03:30:21
合計ジャッジ時間 3,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 5 ms
6,944 KB
testcase_08 AC 7 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 4 ms
6,944 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 5 ms
6,944 KB
testcase_15 AC 5 ms
7,168 KB
testcase_16 AC 5 ms
6,944 KB
testcase_17 AC 2 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,940 KB
testcase_21 AC 3 ms
6,944 KB
testcase_22 AC 4 ms
6,948 KB
testcase_23 AC 4 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 9 ms
7,808 KB
testcase_26 AC 5 ms
7,148 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 6 ms
7,552 KB
testcase_29 AC 21 ms
20,864 KB
testcase_30 AC 17 ms
13,824 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 45 ms
22,400 KB
testcase_33 AC 27 ms
13,440 KB
testcase_34 AC 6 ms
7,040 KB
testcase_35 AC 9 ms
12,604 KB
testcase_36 AC 149 ms
109,696 KB
testcase_37 AC 150 ms
103,552 KB
testcase_38 AC 95 ms
54,912 KB
testcase_39 AC 52 ms
27,648 KB
testcase_40 AC 123 ms
93,060 KB
testcase_41 AC 27 ms
29,308 KB
testcase_42 AC 146 ms
106,496 KB
testcase_43 AC 89 ms
59,904 KB
testcase_44 AC 43 ms
39,888 KB
testcase_45 AC 63 ms
56,320 KB
testcase_46 AC 91 ms
20,832 KB
testcase_47 AC 90 ms
19,712 KB
testcase_48 AC 329 ms
219,184 KB
testcase_49 AC 342 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 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])%N;
	}
	cout<<ans<<endl;
    return 0;
}
0