結果
問題 | No.417 チューリップバブル |
ユーザー | neko0774 |
提出日時 | 2023-01-31 13:42:41 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 803 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 87,052 KB |
実行使用メモリ | 77,676 KB |
最終ジャッジ日時 | 2023-09-13 07:07:33 |
合計ジャッジ時間 | 14,223 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
76,076 KB |
testcase_01 | AC | 78 ms
76,352 KB |
testcase_02 | AC | 81 ms
76,304 KB |
testcase_03 | AC | 78 ms
76,092 KB |
testcase_04 | AC | 72 ms
75,372 KB |
testcase_05 | AC | 73 ms
75,420 KB |
testcase_06 | AC | 81 ms
75,980 KB |
testcase_07 | AC | 80 ms
76,228 KB |
testcase_08 | AC | 153 ms
76,252 KB |
testcase_09 | AC | 263 ms
76,340 KB |
testcase_10 | AC | 323 ms
76,204 KB |
testcase_11 | AC | 1,184 ms
76,128 KB |
testcase_12 | AC | 1,177 ms
76,504 KB |
testcase_13 | AC | 484 ms
76,348 KB |
testcase_14 | AC | 1,875 ms
77,568 KB |
testcase_15 | AC | 191 ms
76,192 KB |
testcase_16 | AC | 192 ms
76,332 KB |
testcase_17 | AC | 1,007 ms
77,292 KB |
testcase_18 | AC | 1,008 ms
77,676 KB |
testcase_19 | AC | 1,010 ms
77,512 KB |
testcase_20 | TLE | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
ソースコード
import sys sys.setrecursionlimit(10**7) def main(): N, M = map(int, input().split()) U = [int(input()) for _ in range(N)] G = [[] for _ in range(N)] for _ in range(N-1): A,B,C = map(int, input().split()) G[A].append([B, C]) G[B].append([A, C]) dp = [[0]*(M+1) for _ in range(N)] seen = [0]*N import pypyjit pypyjit.set_param('max_unroll_recursion=-1') def dfs(x, par=-1): seen[x] = 1 dp[x][0] = U[x] for nx, t in G[x]: if nx==par: continue dfs(nx, x) for m in range(M+1)[::-1]: for mm in range(M+1): T = m+mm+2*t if T<M+1: dp[x][T] = max(dp[x][T], dp[x][m]+dp[nx][mm]) dfs(0) print(max(dp[0])) main()