結果
問題 |
No.27 板の準備
|
ユーザー |
|
提出日時 | 2017-08-16 22:26:49 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 725 bytes |
コンパイル時間 | 3,451 ms |
コンパイル使用メモリ | 67,104 KB |
実行使用メモリ | 6,812 KB |
最終ジャッジ日時 | 2024-06-30 02:45:31 |
合計ジャッジ時間 | 4,132 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 1 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 41) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'future' [UnusedImport] /home/judge/data/code/Main.nim(1, 48) Warning: imported and not used: 'macros' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,future,macros template get*():string = stdin.readLine().strip() template `min=`*(x,y:typed):void = x = min(x,y) let V = get().split().map(parseInt).sorted(cmp) # 4 * [1,30] const INF = 1e6.int var ans = INF # 30 * 30 * 30 for A in 1..V.max(): for B in 1..<A: for C in 1..<B: var dp = newSeqWith(V.max()+1,INF) # v を ABC で 作るのに掛かるコストの最小値 dp[0] = 0 for v in 0..V.max()-A: if dp[v] != INF: dp[v + A] .min= dp[v] + 1 for v in 0..V.max()-B: if dp[v] != INF: dp[v + B] .min= dp[v] + 1 for v in 0..V.max()-C: if dp[v] != INF: dp[v + C] .min= dp[v] + 1 ans .min= V.mapIt(dp[it]).sum() echo ans