結果
| 問題 | No.1163 I want to be a high achiever |
| ユーザー |
|
| 提出日時 | 2020-08-11 15:36:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 2,000 ms |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 76,052 KB |
| 最終ジャッジ日時 | 2024-10-09 11:26:51 |
| 合計ジャッジ時間 | 4,009 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
n, x = [int(i) for i in input().split()]
a = [int(i)-x for i in input().split()]
b = [int(i) for i in input().split()]
if all(map(lambda x: x < 0, a)):
print(-1)
exit()
sum_a = sum(a)
if sum_a >= 0:
print(0)
exit()
sum_a *= -1
dp = [10 ** 8] * (sum_a+1)
dp[0] = 0
for index, score in enumerate(a):
if score >= 0:
continue
for i in reversed(range(sum_a)):
j = min(sum_a, i - score)
dp[j] = min(dp[j], dp[i] + b[index])
print(dp[-1])