結果
問題 |
No.37 遊園地のアトラクション
|
ユーザー |
![]() |
提出日時 | 2017-07-27 22:13:23 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 15 ms / 5,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 5,072 ms |
コンパイル使用メモリ | 65,724 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 13:22:46 |
合計ジャッジ時間 | 4,889 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
コンパイルメッセージ
/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: dp[n + 1][i] = max(dp[n + 1][i],dp[n][i]) 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) echo dp[N][T]