結果

問題 No.1111 コード進行
ユーザー nanophoto12nanophoto12
提出日時 2020-07-24 21:53:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,260 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 205,496 KB
実行使用メモリ 122,124 KB
最終ジャッジ日時 2023-09-08 03:59:55
合計ジャッジ時間 7,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 4 ms
6,376 KB
testcase_06 AC 6 ms
8,340 KB
testcase_07 AC 6 ms
7,308 KB
testcase_08 AC 4 ms
4,432 KB
testcase_09 AC 4 ms
6,664 KB
testcase_10 AC 7 ms
9,664 KB
testcase_11 AC 3 ms
4,488 KB
testcase_12 AC 7 ms
8,072 KB
testcase_13 AC 5 ms
7,264 KB
testcase_14 AC 9 ms
9,584 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 7 ms
8,800 KB
testcase_17 AC 7 ms
9,584 KB
testcase_18 AC 3 ms
4,460 KB
testcase_19 AC 2 ms
4,452 KB
testcase_20 AC 4 ms
6,084 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 10 ms
12,624 KB
testcase_23 AC 4 ms
6,376 KB
testcase_24 AC 5 ms
6,948 KB
testcase_25 AC 10 ms
11,696 KB
testcase_26 WA -
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 83 ms
104,328 KB
testcase_29 AC 41 ms
46,736 KB
testcase_30 WA -
testcase_31 AC 12 ms
15,128 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 48 ms
60,476 KB
testcase_35 AC 83 ms
102,456 KB
testcase_36 AC 126 ms
109,668 KB
testcase_37 AC 39 ms
29,628 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 101 ms
122,124 KB
testcase_42 AC 65 ms
51,932 KB
testcase_43 WA -
testcase_44 AC 28 ms
26,068 KB
testcase_45 AC 71 ms
76,220 KB
testcase_46 WA -
testcase_47 AC 104 ms
17,508 KB
testcase_48 AC 10 ms
8,348 KB
testcase_49 AC 11 ms
8,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

template<typename T>
void chmin(T & ref, const T  value) {
	if (ref > value) ref = value;
}

int main() {
	//dp[i][j][k]...i回目にて最後がjで複雑度合計がk
	ll n, m, k;
	cin >> n >> m >> k;
	vector<ll> ps(m, 0), qs(m,0), cs(m,0);
	ll u = 0;
	rep(i, m) {
		cin >> ps[i] >> qs[i] >> cs[i];
		ps[i]--;
		qs[i]--;
		u = max(u, ps[i]);
		u = max(u, qs[i]);
	}
	u++;
	vector<vector<vector<ll>>> dp(n+1, vector<vector<ll>>(u, vector<ll>(k+1, 0)));
	rep(i, u) {
		dp[0][i][0] = 1;
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = 0; j < m; j++) {
			for (int p = 0; p <= k; p++) {
				ll np = p + cs[j];
				if (np <= k) {
					(dp[i + 1][qs[j]][np] += dp[i][ps[j]][p]) %= mod;
				}
			}
		}
	}
	ll sum = 0;
	rep(i, u) {
		sum += dp[n-1][i][k];
	}
	cout << sum << endl;
	
	return 0;
}
0