結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,044 KB
testcase_01 AC 76 ms
76,120 KB
testcase_02 AC 76 ms
76,012 KB
testcase_03 AC 75 ms
75,896 KB
testcase_04 AC 71 ms
71,340 KB
testcase_05 AC 68 ms
71,376 KB
testcase_06 AC 78 ms
76,160 KB
testcase_07 AC 77 ms
76,184 KB
testcase_08 AC 112 ms
76,216 KB
testcase_09 AC 156 ms
76,300 KB
testcase_10 AC 183 ms
76,400 KB
testcase_11 AC 556 ms
76,280 KB
testcase_12 AC 552 ms
76,348 KB
testcase_13 AC 256 ms
76,184 KB
testcase_14 AC 849 ms
77,624 KB
testcase_15 AC 134 ms
76,284 KB
testcase_16 AC 130 ms
76,312 KB
testcase_17 AC 490 ms
77,712 KB
testcase_18 AC 491 ms
77,368 KB
testcase_19 AC 497 ms
77,536 KB
testcase_20 AC 1,699 ms
78,532 KB
testcase_21 AC 1,685 ms
78,360 KB
testcase_22 AC 1,689 ms
78,616 KB
testcase_23 AC 1,681 ms
78,400 KB
testcase_24 AC 79 ms
76,112 KB
testcase_25 AC 1,696 ms
78,512 KB
testcase_26 AC 220 ms
76,152 KB
testcase_27 AC 1,202 ms
77,944 KB
testcase_28 AC 1,679 ms
78,580 KB
testcase_29 AC 1,673 ms
78,116 KB
testcase_30 AC 1,674 ms
78,460 KB
testcase_31 AC 1,671 ms
78,120 KB
testcase_32 AC 75 ms
75,692 KB
testcase_33 AC 118 ms
76,312 KB
testcase_34 AC 391 ms
76,276 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)]
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