結果
問題 | No.1111 コード進行 |
ユーザー | xuanji |
提出日時 | 2020-07-10 22:38:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 880 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 284,328 KB |
最終ジャッジ日時 | 2024-04-19 21:01:21 |
合計ジャッジ時間 | 16,034 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
65,408 KB |
testcase_01 | AC | 59 ms
60,160 KB |
testcase_02 | AC | 56 ms
59,904 KB |
testcase_03 | AC | 60 ms
60,032 KB |
testcase_04 | AC | 57 ms
60,288 KB |
testcase_05 | AC | 58 ms
60,544 KB |
testcase_06 | AC | 106 ms
77,056 KB |
testcase_07 | AC | 107 ms
78,208 KB |
testcase_08 | AC | 61 ms
63,744 KB |
testcase_09 | AC | 116 ms
77,312 KB |
testcase_10 | AC | 64 ms
63,360 KB |
testcase_11 | AC | 59 ms
62,336 KB |
testcase_12 | AC | 177 ms
84,552 KB |
testcase_13 | AC | 56 ms
61,056 KB |
testcase_14 | AC | 290 ms
94,932 KB |
testcase_15 | AC | 60 ms
61,184 KB |
testcase_16 | AC | 121 ms
79,744 KB |
testcase_17 | AC | 62 ms
60,416 KB |
testcase_18 | AC | 56 ms
60,544 KB |
testcase_19 | AC | 57 ms
60,160 KB |
testcase_20 | AC | 62 ms
61,696 KB |
testcase_21 | AC | 57 ms
60,544 KB |
testcase_22 | AC | 56 ms
60,288 KB |
testcase_23 | AC | 61 ms
61,568 KB |
testcase_24 | AC | 76 ms
68,480 KB |
testcase_25 | AC | 245 ms
102,816 KB |
testcase_26 | AC | 253 ms
85,356 KB |
testcase_27 | AC | 64 ms
62,464 KB |
testcase_28 | AC | 61 ms
61,056 KB |
testcase_29 | AC | 65 ms
65,664 KB |
testcase_30 | AC | 1,445 ms
248,104 KB |
testcase_31 | AC | 159 ms
81,680 KB |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | AC | 112 ms
78,080 KB |
testcase_35 | AC | 54 ms
60,288 KB |
testcase_36 | AC | 116 ms
77,696 KB |
testcase_37 | AC | 208 ms
83,792 KB |
testcase_38 | TLE | - |
testcase_39 | TLE | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
#!/usr/bin/env python3 MODULUS = 10**9+7 from collections import defaultdict from sys import stdin, stdout def input(): return stdin.readline().strip() 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)) ret = sum(ans(N, v, K) for v in range(1, 301)) print(ret % MODULUS)