結果
問題 | No.417 チューリップバブル |
ユーザー | konsin_tokage |
提出日時 | 2018-04-01 13:01:07 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 86,680 KB |
実行使用メモリ | 82,368 KB |
最終ジャッジ日時 | 2023-09-08 11:25:35 |
合計ジャッジ時間 | 15,044 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
79,864 KB |
testcase_01 | AC | 80 ms
75,604 KB |
testcase_02 | AC | 82 ms
75,716 KB |
testcase_03 | AC | 80 ms
75,816 KB |
testcase_04 | AC | 74 ms
74,804 KB |
testcase_05 | AC | 74 ms
74,928 KB |
testcase_06 | AC | 82 ms
75,748 KB |
testcase_07 | AC | 82 ms
75,708 KB |
testcase_08 | AC | 177 ms
75,880 KB |
testcase_09 | AC | 295 ms
75,752 KB |
testcase_10 | AC | 329 ms
75,520 KB |
testcase_11 | AC | 1,303 ms
75,704 KB |
testcase_12 | AC | 1,309 ms
76,020 KB |
testcase_13 | AC | 790 ms
75,856 KB |
testcase_14 | TLE | - |
testcase_15 | AC | 205 ms
75,840 KB |
testcase_16 | AC | 205 ms
75,992 KB |
testcase_17 | AC | 1,066 ms
75,816 KB |
testcase_18 | AC | 1,066 ms
75,656 KB |
testcase_19 | AC | 1,069 ms
75,632 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 | -- | - |
ソースコード
n, m = map(int, input().split()) u = [int(input()) for _ in range(n)] graph = [[] for _ in range(n)] for _ in range(n-1): a, b, c = map(int, input().split()) graph[a].append((b, c)) graph[b].append((a, c)) dp = [[0]*(m+1) for _ in range(n)] def dfs(i, parent): for j, cost in graph[i]: if j == parent: continue dfs(j, i) for k in range(m+1)[::-1]: for l in range(m+1)[::-1]: if k<l+cost*2: continue dp[i][k] = max(dp[i][k], dp[i][k-l-cost*2]+dp[j][l]) for j in range(m+1): dp[i][j] += u[i] dfs(0, 0) print(max(dp[0]))