結果
問題 |
No.1163 I want to be a high achiever
|
ユーザー |
|
提出日時 | 2020-08-11 15:36:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 487 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 16,256 KB |
最終ジャッジ日時 | 2024-10-09 11:26:41 |
合計ジャッジ時間 | 4,118 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 4 TLE * 1 -- * 25 |
ソースコード
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])