結果

問題 No.37 遊園地のアトラクション
ユーザー むらためむらため
提出日時 2017-08-16 21:45:20
言語 Nim
(2.0.2)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 567 bytes
コンパイル時間 3,230 ms
コンパイル使用メモリ 66,176 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 19:59:24
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 5 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

diff #

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 = 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]
0