結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
80,764 KB
testcase_01 AC 77 ms
76,224 KB
testcase_02 AC 77 ms
76,216 KB
testcase_03 AC 75 ms
75,932 KB
testcase_04 AC 74 ms
71,288 KB
testcase_05 AC 69 ms
71,308 KB
testcase_06 AC 77 ms
76,252 KB
testcase_07 AC 76 ms
76,284 KB
testcase_08 AC 111 ms
76,332 KB
testcase_09 AC 154 ms
76,316 KB
testcase_10 AC 181 ms
76,328 KB
testcase_11 AC 555 ms
76,312 KB
testcase_12 AC 552 ms
76,392 KB
testcase_13 AC 253 ms
76,264 KB
testcase_14 AC 847 ms
77,576 KB
testcase_15 AC 131 ms
75,976 KB
testcase_16 AC 130 ms
76,268 KB
testcase_17 AC 490 ms
77,536 KB
testcase_18 AC 491 ms
77,364 KB
testcase_19 AC 497 ms
77,608 KB
testcase_20 AC 1,711 ms
78,620 KB
testcase_21 AC 1,680 ms
78,452 KB
testcase_22 AC 1,687 ms
78,448 KB
testcase_23 AC 1,689 ms
78,392 KB
testcase_24 AC 79 ms
76,204 KB
testcase_25 AC 1,690 ms
78,372 KB
testcase_26 AC 218 ms
76,268 KB
testcase_27 AC 1,194 ms
77,580 KB
testcase_28 AC 1,675 ms
78,376 KB
testcase_29 AC 1,677 ms
78,480 KB
testcase_30 AC 1,680 ms
78,056 KB
testcase_31 AC 1,676 ms
78,372 KB
testcase_32 AC 73 ms
76,108 KB
testcase_33 AC 119 ms
76,064 KB
testcase_34 AC 397 ms
76,028 KB
testcase_35 TLE -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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