結果

問題 No.1111 コード進行
ユーザー xuanjixuanji
提出日時 2020-07-10 22:13:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 870 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 312,816 KB
最終ジャッジ日時 2024-04-19 17:27:35
合計ジャッジ時間 13,166 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
60,544 KB
testcase_01 AC 43 ms
54,784 KB
testcase_02 WA -
testcase_03 AC 42 ms
55,040 KB
testcase_04 AC 38 ms
54,912 KB
testcase_05 WA -
testcase_06 AC 69 ms
77,376 KB
testcase_07 AC 75 ms
78,060 KB
testcase_08 AC 47 ms
64,768 KB
testcase_09 WA -
testcase_10 AC 41 ms
55,552 KB
testcase_11 AC 47 ms
61,952 KB
testcase_12 WA -
testcase_13 AC 39 ms
55,168 KB
testcase_14 AC 242 ms
95,180 KB
testcase_15 AC 40 ms
55,424 KB
testcase_16 AC 80 ms
78,548 KB
testcase_17 AC 39 ms
55,424 KB
testcase_18 AC 39 ms
55,552 KB
testcase_19 AC 37 ms
54,784 KB
testcase_20 AC 39 ms
55,168 KB
testcase_21 AC 39 ms
55,552 KB
testcase_22 AC 38 ms
55,552 KB
testcase_23 AC 40 ms
55,680 KB
testcase_24 AC 46 ms
61,312 KB
testcase_25 AC 185 ms
98,892 KB
testcase_26 WA -
testcase_27 AC 44 ms
61,824 KB
testcase_28 AC 38 ms
55,040 KB
testcase_29 AC 38 ms
55,168 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 39 ms
54,912 KB
testcase_35 AC 38 ms
55,552 KB
testcase_36 AC 81 ms
77,696 KB
testcase_37 AC 167 ms
84,424 KB
testcase_38 WA -
testcase_39 TLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

from collections import defaultdict

from sys import stdin, stdout
 
def input():
    return stdin.readline().strip()

MODULUS = 10**9+7

N, M, K = input().split(' ')
N = int(N)
M = int(M)
K = int(K)

from functools import lru_cache

@lru_cache(None)
def ans(length, last, target):
    # how many length-`length` progressions are there with last chord `last` and complexity `target`
    if length == 1:
        if target == 0: return 1
        return 0
    if target < 0: return 0

    ret = 0
    for (prev, cost) in neighbours[last]:
        ret += ans(length-1, prev, target-cost)
        ret = ret % MODULUS
    return ret

neighbours = defaultdict(set)

for _ in range(M):
    P, Q, C = input().split(' ')
    P = int(P)
    Q = int(Q)
    C = int(C)

    neighbours[Q].add((P, C))

print(sum(ans(N, v, K) for v in range(1, M+1)) % MODULUS)
0