結果
問題 | No.1364 [Renaming] Road to Cherry from Zelkova |
ユーザー |
![]() |
提出日時 | 2021-01-22 23:38:51 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 593 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 852,324 KB |
最終ジャッジ日時 | 2024-12-28 08:58:48 |
合計ジャッジ時間 | 72,537 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 4 WA * 26 TLE * 5 MLE * 10 |
ソースコード
from time import time import sys import io, os sys.setrecursionlimit(10**9) input = sys.stdin.buffer.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline mod = 10**9+7 n, m = map(int, input().split()) ind = [[] for i in range(n+1)] for i in range(m): u, v, l, a = map(int, input().split()) ind[v].append((u, l, a)) dp = [0]*(n+1) def dfs(v): tt = (time() - stime) / 2.2 if tt >= 1: print('INF') exit() for u, l, a in ind[v]: dfs(u) dp[v] += (dp[u]+l)*a dp[v] %= mod stime = time() dfs(n) #print(dp) print(dp[n])