結果

問題 No.1111 コード進行
ユーザー nephrologistnephrologist
提出日時 2020-07-10 22:03:46
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 934 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 297,036 KB
最終ジャッジ日時 2023-08-01 17:58:23
合計ジャッジ時間 13,268 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,404 KB
testcase_01 AC 73 ms
75,924 KB
testcase_02 AC 66 ms
71,276 KB
testcase_03 AC 67 ms
71,208 KB
testcase_04 AC 67 ms
71,112 KB
testcase_05 AC 92 ms
79,192 KB
testcase_06 AC 107 ms
81,748 KB
testcase_07 AC 109 ms
81,440 KB
testcase_08 AC 101 ms
78,780 KB
testcase_09 AC 103 ms
79,892 KB
testcase_10 AC 112 ms
83,672 KB
testcase_11 AC 96 ms
78,596 KB
testcase_12 AC 111 ms
81,576 KB
testcase_13 AC 108 ms
80,400 KB
testcase_14 AC 141 ms
84,164 KB
testcase_15 AC 97 ms
78,548 KB
testcase_16 AC 113 ms
82,372 KB
testcase_17 AC 106 ms
84,160 KB
testcase_18 AC 87 ms
76,556 KB
testcase_19 AC 82 ms
76,520 KB
testcase_20 AC 101 ms
79,316 KB
testcase_21 AC 81 ms
76,436 KB
testcase_22 AC 121 ms
86,220 KB
testcase_23 AC 106 ms
80,576 KB
testcase_24 AC 103 ms
80,860 KB
testcase_25 AC 125 ms
85,520 KB
testcase_26 WA -
testcase_27 AC 98 ms
78,324 KB
testcase_28 AC 322 ms
187,132 KB
testcase_29 AC 225 ms
124,908 KB
testcase_30 WA -
testcase_31 AC 121 ms
89,204 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 258 ms
156,992 KB
testcase_35 AC 304 ms
181,148 KB
testcase_36 AC 657 ms
185,836 KB
testcase_37 AC 294 ms
106,528 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 373 ms
200,188 KB
testcase_42 AC 369 ms
128,616 KB
testcase_43 WA -
testcase_44 AC 183 ms
102,032 KB
testcase_45 AC 325 ms
152,608 KB
testcase_46 WA -
testcase_47 AC 1,639 ms
297,036 KB
testcase_48 AC 117 ms
84,032 KB
testcase_49 AC 100 ms
84,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

mod = 10 ** 9 + 7
n, m, k = map(int, readline().split())
mm = map(int, read().split())
PQC = zip(mm, mm, mm)

jisho = [{} for _ in range(300)]

for p, q, c in PQC:
    p -= 1
    q -= 1
    jisho[p][q] = c

# dp[i][j][k]: i番目まで前がjで、合計kとなる組み合わせ
dp = [[[0] * (k + 1) for _ in range(300)] for _ in range(n)]

for j in range(300):
    dp[0][j][0] = 1
for i in range(n - 1):
    for j in range(300):
        for a in range(k + 1):
            ni = i + 1
            dic = jisho[j]
            for idx, val in dic.items():
                if val + a > k:
                    continue
                nj = idx
                na = val + a
                dp[ni][nj][na] += dp[i][j][a]
                dp[ni][nj][na] %= mod
ans = 0
for j in range(300):
    ans += dp[-1][j][k]
print(ans)
0