結果

問題 No.1111 コード進行
ユーザー batasanblogbatasanblog
提出日時 2023-04-07 08:07:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,404 bytes
コンパイル時間 3,878 ms
コンパイル使用メモリ 263,744 KB
実行使用メモリ 222,976 KB
最終ジャッジ日時 2024-04-10 16:11:21
合計ジャッジ時間 9,680 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 5 ms
7,040 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 10 ms
7,936 KB
testcase_27 AC 4 ms
6,940 KB
testcase_28 AC 162 ms
113,024 KB
testcase_29 AC 65 ms
47,872 KB
testcase_30 AC 128 ms
76,032 KB
testcase_31 AC 18 ms
15,872 KB
testcase_32 AC 123 ms
67,328 KB
testcase_33 AC 93 ms
45,696 KB
testcase_34 AC 115 ms
81,792 KB
testcase_35 AC 146 ms
103,424 KB
testcase_36 AC 210 ms
111,744 KB
testcase_37 AC 48 ms
28,800 KB
testcase_38 AC 35 ms
22,144 KB
testcase_39 AC 156 ms
75,264 KB
testcase_40 AC 191 ms
102,272 KB
testcase_41 AC 180 ms
124,800 KB
testcase_42 AC 96 ms
51,712 KB
testcase_43 AC 81 ms
45,824 KB
testcase_44 AC 33 ms
25,728 KB
testcase_45 AC 112 ms
76,288 KB
testcase_46 AC 3 ms
6,940 KB
testcase_47 AC 397 ms
222,976 KB
testcase_48 AC 3 ms
6,940 KB
testcase_49 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
//using mint = static_modint<998244353>;
//using mint = modint;
using mint = static_modint<1000000007>;
using vm = vector<mint>;
using vvm = vector<vm>;
using vvvm = vector<vvm>;
ostream &operator<<(ostream &o,const mint &m){cout<<m.val();return o;}
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll,ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);++i)
#define reps(i,s,n) for(ll i=(s);i<(ll)(n);++i)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);++i)
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const long long INF = 1e18;

#ifdef DEBUG
#include <debug.hpp>
#endif

int main(){
#ifdef DEBUG
	cout << "--- Input ---" << endl;
#endif
	ll N,M,K;cin>>N>>M>>K;
	vector<vector<pl>> E(301);
	rep(i,M){
		ll a,b,c;cin>>a>>b>>c;
		//E.at(a).at(i)=make_pair(b,c);
		E.at(a).push_back({b,c});
	}
	reps(i,1,301)E.at(0).push_back({i,0});
#ifdef DEBUG
	cout << "--- Logic ---" << endl;
#endif
	vvvm dp(N+1,vvm(K*2+1,vm(301)));
	dp.at(0).at(0).at(0)=1;
	rep(i,N)rep(k,K+1)rep(lst,301){
		for(auto &p:E.at(lst)){
			dp.at(i+1).at(k+p.second).at(p.first)
				+=dp.at(i).at(k).at(lst);
		}
	}
#ifdef DEBUG
	cout<<dp;
	cout << "--- Answer ---" << endl;
#endif
	mint ans=0;
	reps(lst,1,301)ans+=dp.at(N).at(K).at(lst);
	cout<<ans<<endl;

	return 0;
}
//cout << fixed << setprecision(9);
0