結果

問題 No.1111 コード進行
ユーザー kotatsugamekotatsugame
提出日時 2020-07-10 21:32:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 72,680 KB
実行使用メモリ 215,680 KB
最終ジャッジ日時 2024-04-19 15:53:22
合計ジャッジ時間 3,189 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 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,944 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 3 ms
6,944 KB
testcase_14 AC 5 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 4 ms
7,112 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 7 ms
7,424 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 15 ms
8,524 KB
testcase_29 AC 20 ms
17,280 KB
testcase_30 AC 21 ms
14,540 KB
testcase_31 AC 3 ms
6,940 KB
testcase_32 AC 30 ms
19,792 KB
testcase_33 AC 25 ms
12,544 KB
testcase_34 AC 12 ms
6,940 KB
testcase_35 AC 17 ms
9,728 KB
testcase_36 AC 134 ms
106,452 KB
testcase_37 AC 93 ms
88,576 KB
testcase_38 AC 50 ms
45,904 KB
testcase_39 AC 47 ms
27,476 KB
testcase_40 AC 104 ms
84,992 KB
testcase_41 AC 38 ms
26,368 KB
testcase_42 AC 105 ms
94,800 KB
testcase_43 AC 64 ms
54,532 KB
testcase_44 AC 31 ms
31,488 KB
testcase_45 AC 57 ms
50,248 KB
testcase_46 AC 18 ms
19,916 KB
testcase_47 AC 104 ms
20,680 KB
testcase_48 AC 206 ms
215,680 KB
testcase_49 AC 155 ms
161,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
const long mod=1e9+7;
long dp[301][301][301];
int N,M,K;
vector<pair<int,int> >G[301];
main()
{
	cin>>N>>M>>K;
	for(int i=0;i<M;i++)
	{
		int u,v,c;cin>>u>>v>>c;
		G[u].push_back(make_pair(v,c));
	}
	for(int i=1;i<=300;i++)dp[1][i][0]=1;
	for(int i=1;i<N;i++)for(int j=1;j<=300;j++)for(int k=0;k<=K;k++)
	{
		for(pair<int,int>e:G[j])if(k+e.second<=K)(dp[i+1][e.first][k+e.second]+=dp[i][j][k])%=mod;
	}
	long ans=0;
	for(int i=1;i<=300;i++)ans+=dp[N][i][K];
	cout<<ans%mod<<endl;
}
0