結果
問題 |
No.37 遊園地のアトラクション
|
ユーザー |
![]() |
提出日時 | 2017-07-27 22:09:49 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 668 bytes |
コンパイル時間 | 3,353 ms |
コンパイル使用メモリ | 65,920 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 01:50:26 |
合計ジャッジ時間 | 5,103 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 25 WA * 2 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import sequtils,strutils,math type item = tuple[c : int, v : int] var T = stdin.readline.parseInt N = stdin.readline.parseInt C = stdin.readline.split.map(parseInt) V = stdin.readline.split.map(parseInt) dp : array[16,array[10001,int]] c,v,v2 : int for n in 0..<N: c = C[n] v = V[n] v2 = v var items = newSeq[item](0) items.add((c,v)) while v2 > 1: v2 = v2 div 2 v += v2 c += C[n] items.add((c,v)) for i in 0..T: for t in items: if t.c + i <= T: dp[n + 1][i + t.c] = max(@[dp[n + 1][i + t.c], dp[n][i] + t.v, dp[n][i + t.c]]) echo dp[N][T]