結果
問題 |
No.198 キャンディー・ボックス2
|
ユーザー |
![]() |
提出日時 | 2016-05-19 06:10:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 283 bytes |
コンパイル時間 | 211 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-06 05:53:20 |
合計ジャッジ時間 | 1,832 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 WA * 4 |
ソースコード
b = int(input()) n = int(input()) a = [int(input()) for i in range(n)] ans = 1e12 for i in range(n): top = a[i] diff = [a[j] - top for j in range(n)] diffabs = [abs(a[j] - top) for j in range(n)] if sum(diff) + b >= 0: ans = min(ans, sum(diffabs)) print(ans)