結果

問題 No.1163 I want to be a high achiever
ユーザー brthyyjp
提出日時 2021-07-08 20:32:22
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 583 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 184 ms
コンパイル使用メモリ 84,988 KB
実行使用メモリ 335,508 KB
最終ジャッジ日時 2026-03-22 13:40:01
合計ジャッジ時間 73,987 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

INF = 10**18
s = sum(A)

dp = [[INF]*(s+1) for i in range(n+1)]
dp[0][0] = 0
for a, b in zip(A, B):
    for j in reversed(range(n)):
        for k in reversed(range(s+1)):
            if dp[j][k] == INF:
                continue
            dp[j+1][k+a] = min(dp[j+1][k+a], dp[j][k])
            dp[j][k] += b
ans = INF
for j in range(1, n+1):
    for k in range(s+1):
        if k >= x*j:
            ans = min(ans, dp[j][k])
if ans != INF:
    print(ans)
else:
    print(-1)
0