結果

問題 No.1111 コード進行
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-18 19:59:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 72,728 KB
実行使用メモリ 215,716 KB
最終ジャッジ日時 2024-04-28 10:46:34
合計ジャッジ時間 3,015 ms
ジャッジサーバーID
(参考情報)
judge2 / 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,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 4 ms
10,032 KB
testcase_07 AC 4 ms
12,404 KB
testcase_08 AC 4 ms
12,336 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 5 ms
16,528 KB
testcase_11 AC 3 ms
10,496 KB
testcase_12 AC 4 ms
10,168 KB
testcase_13 AC 3 ms
8,396 KB
testcase_14 AC 5 ms
11,952 KB
testcase_15 AC 3 ms
14,504 KB
testcase_16 AC 4 ms
10,088 KB
testcase_17 AC 4 ms
16,364 KB
testcase_18 AC 3 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 5 ms
16,168 KB
testcase_23 AC 3 ms
11,896 KB
testcase_24 AC 3 ms
10,328 KB
testcase_25 AC 7 ms
16,804 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 28 ms
77,072 KB
testcase_29 AC 26 ms
80,700 KB
testcase_30 WA -
testcase_31 AC 7 ms
21,980 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 31 ms
76,700 KB
testcase_35 AC 32 ms
79,096 KB
testcase_36 AC 74 ms
120,584 KB
testcase_37 AC 41 ms
108,696 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 40 ms
87,232 KB
testcase_42 AC 50 ms
114,700 KB
testcase_43 WA -
testcase_44 AC 22 ms
75,652 KB
testcase_45 AC 43 ms
94,772 KB
testcase_46 WA -
testcase_47 AC 128 ms
85,292 KB
testcase_48 AC 81 ms
215,716 KB
testcase_49 AC 72 ms
179,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <iostream>
using namespace std;
using ll = long long;
const ll mod = 1000000009;
ll dp[301][301][301];

struct edge
{
int to;
ll cost;
edge(int to, ll cost):to(to), cost(cost) {}
};


int main()
{
int n, m, k;
cin >> n >> m >> k;
vector<vector<edge>> G(300);
for (int i = 0; i < m; ++i)
{
int p, q;
ll c;
cin >> p >> q >> c;
p--; q--;
G[p].push_back(edge(q, c));
}
for (int i = 0; i < 300; ++i) dp[0][i][0] = 1;
for (int i = 0; i < n - 1; ++i)
{
for (int s = 0; s < 300; ++s)
{
for (int j = 0; j < k + 1; ++j)
{
for (edge& e : G[s])
{
if (j + e.cost <= k)
{
dp[i + 1][e.to][j + e.cost] += dp[i][s][j];
dp[i + 1][e.to][j + e.cost] %= mod;
}
}
}
}
}
ll ans = 0;
for (int i = 0; i < 300; ++i) {
ans += dp[n - 1][i][k];
ans %= mod;
}
cout << ans << endl;
return 0;
}

0