結果

問題 No.417 チューリップバブル
ユーザー neko0774neko0774
提出日時 2023-01-31 14:08:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 635 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 84,612 KB
最終ジャッジ日時 2023-09-13 07:24:40
合計ジャッジ時間 26,897 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
76,324 KB
testcase_01 AC 76 ms
76,264 KB
testcase_02 AC 78 ms
76,244 KB
testcase_03 AC 76 ms
76,136 KB
testcase_04 AC 69 ms
71,456 KB
testcase_05 AC 70 ms
71,456 KB
testcase_06 AC 79 ms
76,136 KB
testcase_07 AC 77 ms
76,280 KB
testcase_08 AC 108 ms
76,216 KB
testcase_09 AC 155 ms
76,240 KB
testcase_10 AC 183 ms
76,120 KB
testcase_11 AC 555 ms
76,124 KB
testcase_12 AC 549 ms
76,492 KB
testcase_13 AC 253 ms
76,280 KB
testcase_14 AC 842 ms
77,316 KB
testcase_15 AC 130 ms
76,324 KB
testcase_16 AC 129 ms
76,256 KB
testcase_17 AC 489 ms
77,476 KB
testcase_18 AC 491 ms
77,364 KB
testcase_19 AC 497 ms
77,484 KB
testcase_20 AC 1,710 ms
78,088 KB
testcase_21 AC 1,683 ms
78,132 KB
testcase_22 AC 1,694 ms
78,608 KB
testcase_23 AC 1,678 ms
78,476 KB
testcase_24 AC 79 ms
75,980 KB
testcase_25 AC 1,686 ms
78,332 KB
testcase_26 AC 219 ms
76,300 KB
testcase_27 AC 1,189 ms
77,856 KB
testcase_28 AC 1,676 ms
78,524 KB
testcase_29 AC 1,672 ms
78,580 KB
testcase_30 AC 1,683 ms
78,460 KB
testcase_31 AC 1,681 ms
78,084 KB
testcase_32 AC 76 ms
75,728 KB
testcase_33 AC 120 ms
76,132 KB
testcase_34 AC 391 ms
76,344 KB
testcase_35 TLE -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
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 = [[U[i]]*(M+1) for i in range(N)]
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
def dfs(x, par=-1):
    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-m+1-2*t):
                T = m+mm+2*t
                dp[x][T] = max(dp[x][T], dp[x][m]+dp[nx][mm])
dfs(0)
print(max(dp[0]))
0