結果

問題 No.37 遊園地のアトラクション
ユーザー 6soukiti296soukiti29
提出日時 2017-07-27 22:09:49
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 3,151 ms
コンパイル使用メモリ 69,000 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 13:39:09
合計ジャッジ時間 4,836 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 13 ms
4,380 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 8 ms
4,376 KB
testcase_07 AC 40 ms
4,380 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 31 ms
4,376 KB
testcase_11 AC 30 ms
4,376 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 AC 12 ms
4,380 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 18 ms
4,376 KB
testcase_17 AC 16 ms
4,376 KB
testcase_18 AC 37 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 7 ms
4,376 KB
testcase_22 AC 55 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 7 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

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