結果

問題 No.37 遊園地のアトラクション
ユーザー szkhtsszkhts
提出日時 2021-08-09 14:55:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 845 ms / 5,000 ms
コード長 356 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,976 KB
実行使用メモリ 10,500 KB
最終ジャッジ日時 2023-10-21 12:45:22
合計ジャッジ時間 7,653 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
10,500 KB
testcase_01 AC 30 ms
10,236 KB
testcase_02 AC 142 ms
10,236 KB
testcase_03 AC 207 ms
10,500 KB
testcase_04 AC 96 ms
10,236 KB
testcase_05 AC 155 ms
10,236 KB
testcase_06 AC 123 ms
10,344 KB
testcase_07 AC 600 ms
10,500 KB
testcase_08 AC 83 ms
10,252 KB
testcase_09 AC 44 ms
10,236 KB
testcase_10 AC 513 ms
10,344 KB
testcase_11 AC 491 ms
10,500 KB
testcase_12 AC 139 ms
10,252 KB
testcase_13 AC 180 ms
10,328 KB
testcase_14 AC 93 ms
10,288 KB
testcase_15 AC 107 ms
10,236 KB
testcase_16 AC 280 ms
10,356 KB
testcase_17 AC 235 ms
10,500 KB
testcase_18 AC 595 ms
10,500 KB
testcase_19 AC 41 ms
10,236 KB
testcase_20 AC 206 ms
10,264 KB
testcase_21 AC 95 ms
10,500 KB
testcase_22 AC 845 ms
10,500 KB
testcase_23 AC 27 ms
10,236 KB
testcase_24 AC 26 ms
10,236 KB
testcase_25 AC 26 ms
10,236 KB
testcase_26 AC 28 ms
10,236 KB
testcase_27 AC 119 ms
10,236 KB
testcase_28 AC 28 ms
10,236 KB
testcase_29 AC 78 ms
10,236 KB
testcase_30 AC 27 ms
10,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
N = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
dp = [0] * 20000

for i in range(N):
    while V[i] > 0:
        for j in range(T - 1, -1, -1):
            dp[j + C[i]] = max(dp[j + C[i]], dp[j] + V[i])

        V[i] = V[i] // 2

ans = 0
for i in range(T + 1):
    ans = max(ans, dp[i])

print(ans)
0