結果

問題 No.1163 I want to be a high achiever
ユーザー brthyyjp
提出日時 2021-07-08 20:32:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 583 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 184,400 KB
最終ジャッジ日時 2024-07-01 12:32:42
合計ジャッジ時間 4,296 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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