結果
問題 | No.1111 コード進行 |
ユーザー | xuanji |
提出日時 | 2020-07-10 22:33:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 87,272 KB |
実行使用メモリ | 284,928 KB |
最終ジャッジ日時 | 2023-08-01 18:36:06 |
合計ジャッジ時間 | 14,200 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 114 ms
72,540 KB |
testcase_01 | AC | 112 ms
72,784 KB |
testcase_02 | WA | - |
testcase_03 | AC | 114 ms
72,776 KB |
testcase_04 | AC | 111 ms
72,496 KB |
testcase_05 | WA | - |
testcase_06 | AC | 127 ms
78,208 KB |
testcase_07 | AC | 150 ms
82,036 KB |
testcase_08 | AC | 120 ms
77,340 KB |
testcase_09 | WA | - |
testcase_10 | AC | 113 ms
72,924 KB |
testcase_11 | AC | 116 ms
76,724 KB |
testcase_12 | WA | - |
testcase_13 | AC | 109 ms
72,920 KB |
testcase_14 | AC | 385 ms
99,344 KB |
testcase_15 | AC | 112 ms
72,692 KB |
testcase_16 | AC | 157 ms
82,676 KB |
testcase_17 | AC | 113 ms
72,788 KB |
testcase_18 | AC | 112 ms
72,560 KB |
testcase_19 | AC | 113 ms
72,796 KB |
testcase_20 | AC | 115 ms
72,692 KB |
testcase_21 | AC | 114 ms
72,792 KB |
testcase_22 | AC | 113 ms
72,960 KB |
testcase_23 | AC | 119 ms
76,468 KB |
testcase_24 | AC | 118 ms
76,692 KB |
testcase_25 | AC | 311 ms
105,816 KB |
testcase_26 | RE | - |
testcase_27 | AC | 116 ms
76,624 KB |
testcase_28 | AC | 111 ms
72,928 KB |
testcase_29 | AC | 111 ms
72,760 KB |
testcase_30 | RE | - |
testcase_31 | WA | - |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
#!/usr/bin/env python3 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, M+1)) MODULUS = 10**9+7 if ret >= MODULUS: assert(False) else: print(ret)