結果
問題 | No.1111 コード進行 |
ユーザー | xuanji |
提出日時 | 2020-07-10 22:38:30 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 422 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 307,884 KB |
最終ジャッジ日時 | 2024-04-19 21:02:13 |
合計ジャッジ時間 | 12,482 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
66,304 KB |
testcase_01 | AC | 45 ms
60,800 KB |
testcase_02 | AC | 44 ms
60,544 KB |
testcase_03 | AC | 46 ms
60,544 KB |
testcase_04 | AC | 43 ms
60,464 KB |
testcase_05 | AC | 45 ms
60,996 KB |
testcase_06 | AC | 85 ms
77,320 KB |
testcase_07 | AC | 82 ms
78,848 KB |
testcase_08 | AC | 49 ms
64,384 KB |
testcase_09 | AC | 91 ms
77,676 KB |
testcase_10 | AC | 52 ms
63,872 KB |
testcase_11 | AC | 54 ms
62,720 KB |
testcase_12 | AC | 149 ms
85,248 KB |
testcase_13 | AC | 45 ms
61,440 KB |
testcase_14 | AC | 246 ms
95,056 KB |
testcase_15 | AC | 47 ms
61,696 KB |
testcase_16 | AC | 88 ms
79,884 KB |
testcase_17 | AC | 48 ms
61,568 KB |
testcase_18 | AC | 44 ms
61,184 KB |
testcase_19 | AC | 45 ms
60,672 KB |
testcase_20 | AC | 48 ms
62,208 KB |
testcase_21 | AC | 45 ms
60,928 KB |
testcase_22 | AC | 46 ms
60,928 KB |
testcase_23 | AC | 47 ms
61,952 KB |
testcase_24 | AC | 57 ms
68,736 KB |
testcase_25 | AC | 195 ms
99,460 KB |
testcase_26 | AC | 199 ms
85,608 KB |
testcase_27 | AC | 47 ms
62,592 KB |
testcase_28 | AC | 44 ms
61,368 KB |
testcase_29 | AC | 48 ms
66,256 KB |
testcase_30 | AC | 1,466 ms
276,164 KB |
testcase_31 | AC | 128 ms
81,396 KB |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | AC | 78 ms
77,228 KB |
testcase_35 | AC | 44 ms
61,752 KB |
testcase_36 | AC | 84 ms
77,872 KB |
testcase_37 | AC | 168 ms
83,664 KB |
testcase_38 | AC | 1,859 ms
288,696 KB |
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) 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)