結果

問題 No.1111 コード進行
ユーザー gingin
提出日時 2020-07-17 21:08:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 996 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 118,752 KB
最終ジャッジ日時 2023-08-19 22:39:56
合計ジャッジ時間 10,320 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,580 KB
testcase_01 AC 71 ms
71,288 KB
testcase_02 AC 74 ms
71,256 KB
testcase_03 AC 75 ms
71,260 KB
testcase_04 AC 74 ms
71,352 KB
testcase_05 AC 74 ms
71,036 KB
testcase_06 AC 82 ms
75,928 KB
testcase_07 AC 86 ms
76,012 KB
testcase_08 AC 80 ms
75,500 KB
testcase_09 AC 85 ms
76,280 KB
testcase_10 AC 77 ms
75,712 KB
testcase_11 AC 76 ms
75,576 KB
testcase_12 AC 91 ms
76,344 KB
testcase_13 AC 74 ms
75,704 KB
testcase_14 AC 97 ms
76,344 KB
testcase_15 AC 76 ms
75,448 KB
testcase_16 AC 86 ms
76,260 KB
testcase_17 AC 75 ms
75,288 KB
testcase_18 AC 76 ms
75,512 KB
testcase_19 AC 73 ms
71,228 KB
testcase_20 AC 71 ms
71,200 KB
testcase_21 AC 77 ms
75,376 KB
testcase_22 AC 76 ms
75,396 KB
testcase_23 AC 76 ms
75,388 KB
testcase_24 AC 78 ms
75,764 KB
testcase_25 AC 117 ms
76,484 KB
testcase_26 AC 139 ms
77,128 KB
testcase_27 AC 82 ms
71,332 KB
testcase_28 AC 91 ms
75,384 KB
testcase_29 AC 95 ms
76,268 KB
testcase_30 AC 328 ms
78,744 KB
testcase_31 AC 109 ms
76,472 KB
testcase_32 AC 476 ms
78,432 KB
testcase_33 AC 541 ms
81,160 KB
testcase_34 AC 102 ms
76,332 KB
testcase_35 AC 98 ms
76,288 KB
testcase_36 AC 109 ms
76,476 KB
testcase_37 AC 113 ms
76,932 KB
testcase_38 AC 313 ms
80,116 KB
testcase_39 AC 996 ms
93,872 KB
testcase_40 AC 974 ms
118,752 KB
testcase_41 AC 82 ms
76,436 KB
testcase_42 AC 102 ms
77,036 KB
testcase_43 AC 670 ms
99,132 KB
testcase_44 AC 78 ms
75,524 KB
testcase_45 AC 77 ms
75,548 KB
testcase_46 AC 102 ms
77,132 KB
testcase_47 AC 101 ms
77,300 KB
testcase_48 AC 103 ms
77,052 KB
testcase_49 AC 85 ms
76,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M, K = list(map(int,input().split()))

    pqc = [[] * 301 for _ in range(301)]
    m = 10**9 + 7

    for _ in range(M):
        P, Q, C = map(int,input().split())
        pqc[P].append((Q,C))

    t = [{0:1} for _ in range(301)]
    for i in range(N-1):
        nt = [{} for _ in range(301)]
        for j in range(1,301):
            for k in t[j]:
                for q, c in pqc[j]:
                    v = k + c
                    if v <= K:
                        nt[q].setdefault(v, 0)
                        nt[q][v] += t[j][k]
                        nt[q][v] %= m
        t = nt

    result = 0
    for i in range(1,301):
        t[i].setdefault(K,0)
        result += t[i][K]
        result %= m

    print(result)

main()


0