結果

問題 No.1163 I want to be a high achiever
ユーザー 👑 rin204rin204
提出日時 2022-03-23 15:20:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 527 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 82,488 KB
実行使用メモリ 263,004 KB
最終ジャッジ日時 2024-04-19 21:20:42
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
69,092 KB
testcase_01 AC 49 ms
62,092 KB
testcase_02 AC 46 ms
61,040 KB
testcase_03 AC 47 ms
62,852 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

inf = 1 << 60
dp = [[-inf] * (100 * n + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i, (a, b) in enumerate(zip(A, B), 1):
    for j in range(i, 0, -1):
        for k in range(100 * j, a - 1, -1):
            dp[j][k] = max(dp[j][k], dp[j - 1][k - a] + b)

ans = -inf
for i in range(1, n + 1):
    for j in range(x * i, 100 * i + 1):
        ans = max(ans, dp[i][j])

if ans < 0:
    print(-1)
else:
    print(sum(B) - ans)
0