結果
問題 |
No.1111 コード進行
|
ユーザー |
![]() |
提出日時 | 2020-07-10 22:10:27 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 84,096 KB |
最終ジャッジ日時 | 2024-10-11 13:16:20 |
合計ジャッジ時間 | 4,428 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 TLE * 1 -- * 42 |
ソースコード
import sys sys.setrecursionlimit(10**6) input = sys.stdin.buffer.readline n, m, k = map(int, input().split()) g = [[] for i in range(300)] for i in range(m): p, q, c = map(int, input().split()) p, q = p-1, q-1 g[p].append((q, c)) ans = 0 def dfs(A): global ans if len(A) == n: s = A[-1][1] if s == k: ans += 1 return p, s = A[-1] for q, c in g[p]: A.append((q, s+c)) dfs(A) A.pop() for i in range(300): dfs([(i, 0)]) print(ans)