結果

問題 No.1163 I want to be a high achiever
ユーザー mlihua09
提出日時 2020-08-26 02:30:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 82,540 KB
実行使用メモリ 66,624 KB
最終ジャッジ日時 2024-11-06 11:57:29
合計ジャッジ時間 4,265 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #


N, X = map(int, input().split())

A = list(map(lambda x: X - int(x), input().split()))

B = list(map(int, input().split()))

n = sum(A)

if n <= 0:
    
    print(0)
    
    exit()
    
dp = [0] + [sum(B)] * n


for i in range(N):
    
    if A[i] > 0:
        
        for j in range(-1, -n - 2, -1):
            
            dp[j] = min(dp[j], dp[max(j - A[i], -n-1)] + B[i])
            
            


if dp[-1] == sum(B):
    
    print(-1)
0