結果
| 問題 |
No.1163 I want to be a high achiever
|
| ユーザー |
|
| 提出日時 | 2020-08-19 17:20:01 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 422 bytes |
| コンパイル時間 | 316 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 17,608 KB |
| 最終ジャッジ日時 | 2024-10-12 05:01:08 |
| 合計ジャッジ時間 | 5,994 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 4 TLE * 1 -- * 25 |
ソースコード
N,X=map(int,input().split())
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
INF=10**18
dp=[INF]*100001
dp[0]=0
for i in range(N):
ndp=[INF]*100001
for j in range(-50000,50001):
if dp[j]==INF:
continue
ndp[j+A[i]-X]=min(ndp[j+A[i]-X],dp[j])
ndp[j]=min(ndp[j],dp[j]+B[i])
dp=ndp
ans=min(dp[0:50001])
if ans==sum(B):
print(-1)
else:
print(ans)