結果
問題 |
No.37 遊園地のアトラクション
|
ユーザー |
|
提出日時 | 2017-08-16 21:49:35 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 3,344 ms |
コンパイル使用メモリ | 66,216 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 13:23:24 |
合計ジャッジ時間 | 4,342 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
コンパイルメッセージ
/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] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,future,macros template get*():string = stdin.readLine().strip() template `max=`*(x,y:typed):void = x = max(x,y) let T = get().parseInt() # < 10000 N = get().parseInt() # < 15 C = get().split().map(parseInt) # < 100 # 残り時間 V = get().split().map(parseInt) # < 500 # 満足度 # 二回目以降は v div 2 var dp : array[10001,int] #newSeqWith(T+1,0) # 残り時間 T for i in 0..<N: var (cost,satis) = (C[i],V[i]) while satis > 0: for t in cost..T: dp[t-cost] .max= dp[t] + satis satis = satis div 2 echo dp[0]