結果
問題 | No.417 チューリップバブル |
ユーザー |
|
提出日時 | 2020-02-06 19:53:12 |
言語 | Nim (2.2.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 881 bytes |
コンパイル時間 | 822 ms |
コンパイル使用メモリ | 65,988 KB |
最終ジャッジ日時 | 2024-11-14 22:06:15 |
合計ジャッジ時間 | 1,350 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(23, 34) Error: type mismatch: got 'seq[int]' for 'map(split(readLine(stdin), {' ', '\t', '\v', '\r', '\n', '\f'}, -1), parseInt)' but expected 'tuple'
ソースコード
import strutils, sequtils, algorithmvarN, M: intU: array[200, int]graph: seq[seq[(int, int)]]dp: array[200, array[1001, int]]proc dfs(cur, parent: int) =dp[cur].fill(U[cur])for (child, ci) in graph[cur]:if child != parent:dfs(child, cur)for i in countdown(M, 0):for j in ci..i:dp[cur][i] = max(dp[cur][i], dp[cur][i - j] + dp[child][j - ci])proc solve() =(N, M) = stdin.readLine.split.map(parseInt)M = M div 2for i in 0..<N:U[i] = stdin.readLine.parseIntgraph = newSeqWith(N, newSeq[(int, int)]())var a, b, c: intfor _ in 0..<N-1:(a, b, c) = stdin.readLine.split.map(parseInt)graph[a].add((b, c))graph[b].add((a, c))dfs(0, -1)echo dp[0][M]when is_main_module:solve()