結果

問題 No.37 遊園地のアトラクション
ユーザー szkhtsszkhts
提出日時 2023-04-16 08:08:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,354 ms / 5,000 ms
コード長 552 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 63,744 KB
最終ジャッジ日時 2024-04-20 00:25:52
合計ジャッジ時間 9,907 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
13,056 KB
testcase_01 AC 33 ms
11,008 KB
testcase_02 AC 212 ms
16,000 KB
testcase_03 AC 307 ms
21,376 KB
testcase_04 AC 128 ms
12,672 KB
testcase_05 AC 205 ms
14,208 KB
testcase_06 AC 202 ms
16,384 KB
testcase_07 AC 969 ms
44,928 KB
testcase_08 AC 113 ms
14,080 KB
testcase_09 AC 50 ms
11,776 KB
testcase_10 AC 740 ms
34,816 KB
testcase_11 AC 716 ms
37,376 KB
testcase_12 AC 210 ms
16,512 KB
testcase_13 AC 271 ms
20,224 KB
testcase_14 AC 130 ms
14,720 KB
testcase_15 AC 164 ms
13,056 KB
testcase_16 AC 418 ms
25,216 KB
testcase_17 AC 350 ms
23,296 KB
testcase_18 AC 930 ms
42,368 KB
testcase_19 AC 49 ms
11,776 KB
testcase_20 AC 324 ms
20,608 KB
testcase_21 AC 146 ms
15,360 KB
testcase_22 AC 1,354 ms
63,744 KB
testcase_23 AC 28 ms
10,880 KB
testcase_24 AC 27 ms
11,008 KB
testcase_25 AC 26 ms
11,136 KB
testcase_26 AC 28 ms
11,008 KB
testcase_27 AC 179 ms
14,464 KB
testcase_28 AC 29 ms
11,008 KB
testcase_29 AC 107 ms
12,544 KB
testcase_30 AC 27 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
T=int(input())
N=int(input())
C=list(map(int,input().split()))
V=list(map(int,input().split()))
Z=list(zip(C,V))
Z2=Z[:]
for z in Z:
    c=z[0]
    v=z[1]
    while True:
        v=math.floor(v/2)
        if v<=0:
            break
        Z2.append((c,v))
A=[[0]*(T+1) for i in range(len(Z2)+1)]
for i in range(1,len(Z2)+1):
    for t in range(1,T+1):
        z=Z2[i-1]
        c=z[0]
        v=z[1]
        if t-c<0:
            A[i][t]=A[i-1][t]
        else:
            A[i][t]=max(A[i-1][t-c]+v,A[i-1][t])
print(max(list(map(max,A))))
0