結果

問題 No.37 遊園地のアトラクション
ユーザー vwxyzvwxyz
提出日時 2024-02-27 08:56:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 823 ms / 5,000 ms
コード長 283 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2024-02-27 08:56:12
合計ジャッジ時間 8,430 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
10,368 KB
testcase_01 AC 33 ms
9,984 KB
testcase_02 AC 154 ms
10,112 KB
testcase_03 AC 209 ms
10,368 KB
testcase_04 AC 95 ms
10,112 KB
testcase_05 AC 144 ms
10,112 KB
testcase_06 AC 162 ms
10,240 KB
testcase_07 AC 684 ms
10,368 KB
testcase_08 AC 80 ms
10,112 KB
testcase_09 AC 43 ms
10,112 KB
testcase_10 AC 544 ms
10,240 KB
testcase_11 AC 463 ms
10,368 KB
testcase_12 AC 138 ms
10,240 KB
testcase_13 AC 179 ms
10,240 KB
testcase_14 AC 101 ms
10,240 KB
testcase_15 AC 114 ms
10,112 KB
testcase_16 AC 296 ms
10,368 KB
testcase_17 AC 246 ms
10,368 KB
testcase_18 AC 601 ms
10,368 KB
testcase_19 AC 42 ms
10,112 KB
testcase_20 AC 216 ms
10,240 KB
testcase_21 AC 108 ms
10,368 KB
testcase_22 AC 823 ms
10,368 KB
testcase_23 AC 29 ms
9,984 KB
testcase_24 AC 29 ms
9,984 KB
testcase_25 AC 28 ms
9,984 KB
testcase_26 AC 29 ms
9,984 KB
testcase_27 AC 154 ms
10,112 KB
testcase_28 AC 29 ms
9,984 KB
testcase_29 AC 101 ms
10,112 KB
testcase_30 AC 29 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
N=int(input())
C=list(map(int,input().split()))
V=list(map(int,input().split()))
inf=1<60
dp=[-inf]*(T+1)
dp[0]=0
for c,v in zip(C,V):
    for _ in range(10):
        for t in range(T,c-1,-1):
            dp[t]=max(dp[t],dp[t-c]+v)
        v//=2
ans=max(dp)
print(ans)
0