結果
| 問題 |
No.1163 I want to be a high achiever
|
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-02-24 04:22:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 439 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 67,092 KB |
| 最終ジャッジ日時 | 2024-09-22 23:21:31 |
| 合計ジャッジ時間 | 4,153 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 18 RE * 2 |
ソースコード
N,X=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Upper=0
Lower=[]
L=0
F=0
for a,b in zip(A,B):
if a>=X:
Upper+=a-X
F=1
else:
Lower.append((a,b))
L+=abs(a-X)
if F==0:
print(-1)
exit()
inf=float("inf")
DP=[inf]*(L+1)
DP[L]=0
for a,b in Lower:
k=abs(a-X)
for x in range(L-k+1):
DP[x]=min(DP[x],DP[x+k]+b)
print(min(DP[:Upper]))
Kazun