結果

問題 No.37 遊園地のアトラクション
ユーザー mkawa2mkawa2
提出日時 2020-01-08 16:51:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 497 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,584 KB
最終ジャッジ日時 2024-05-02 12:54:25
合計ジャッジ時間 18,035 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 460 ms
44,196 KB
testcase_01 AC 457 ms
44,320 KB
testcase_02 AC 457 ms
44,064 KB
testcase_03 AC 444 ms
43,936 KB
testcase_04 AC 460 ms
43,948 KB
testcase_05 AC 459 ms
43,940 KB
testcase_06 AC 468 ms
43,940 KB
testcase_07 AC 476 ms
44,192 KB
testcase_08 AC 458 ms
43,936 KB
testcase_09 AC 456 ms
44,324 KB
testcase_10 AC 465 ms
43,940 KB
testcase_11 AC 463 ms
43,936 KB
testcase_12 AC 455 ms
43,940 KB
testcase_13 AC 461 ms
44,068 KB
testcase_14 AC 467 ms
44,200 KB
testcase_15 AC 462 ms
43,944 KB
testcase_16 AC 452 ms
44,068 KB
testcase_17 AC 460 ms
44,192 KB
testcase_18 AC 454 ms
44,196 KB
testcase_19 AC 458 ms
44,320 KB
testcase_20 AC 448 ms
43,936 KB
testcase_21 AC 464 ms
43,944 KB
testcase_22 AC 438 ms
44,064 KB
testcase_23 AC 461 ms
44,196 KB
testcase_24 AC 447 ms
44,068 KB
testcase_25 AC 458 ms
44,200 KB
testcase_26 AC 456 ms
43,936 KB
testcase_27 AC 467 ms
43,940 KB
testcase_28 RE -
testcase_29 AC 454 ms
44,320 KB
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
import numpy as np

def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    t=II()
    n=II()
    cc=LI()
    vv=LI()
    dp=np.zeros(t+1,dtype="i8")
    for c,v in zip(cc,vv):
        while v:
            np.maximum(dp[t:c-1:-1],dp[t-c::-1]+v,out=dp[t:c-1:-1])
#            for i in range(t,c-1,-1):
#                dp[i]=max(dp[i],dp[i-c]+v)
            v>>=1
    print(dp[t])

main()
0