結果
問題 | No.37 遊園地のアトラクション |
ユーザー |
|
提出日時 | 2017-08-16 21:24:45 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 16 ms / 5,000 ms |
コード長 | 698 bytes |
コンパイル時間 | 4,096 ms |
コンパイル使用メモリ | 66,628 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 13:23:09 |
合計ジャッジ時間 | 5,363 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,macrostemplate get*():string = stdin.readLine().strip()template `max=`*(x,y:typed):void = x = max(x,y)letT = get().parseInt() # < 10000N = get().parseInt() # < 15C = get().split().map(parseInt) # < 100 # 残り時間V = get().split().map(parseInt) # < 500 # 満足度# 二回目以降は v div 2var dp = newSeqWith(N+1,newSeqWith(T+1,0)) # 残り時間 Tfor i in 0..<N:var (cost,satis) = (C[i],V[i])var sumSatis = satisfor t in 0..T: dp[i+1][t] = dp[i][t]while satis > 0:for t in cost..T:dp[i+1][t-cost] .max= dp[i][t] + sumSatissatis = satis div 2cost += C[i]sumSatis += satisecho dp[^1][0]