結果
| 問題 | No.198 キャンディー・ボックス2 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-12-18 18:43:16 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 1,000 ms |
| + 536µs | |
| コード長 | 263 bytes |
| 記録 | |
| コンパイル時間 | 268 ms |
| コンパイル使用メモリ | 96,112 KB |
| 実行使用メモリ | 79,104 KB |
| 最終ジャッジ日時 | 2026-07-16 23:51:23 |
| 合計ジャッジ時間 | 3,780 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
b,n,*a = map(int,open(0).read().split())
m = (sum(a)+b)//n
ans = 1<<60
for x in a+[0,m]:
more = less = 0
for ai in a:
if ai >= x: more += ai - x
else: less += x - ai
if more + b < less: continue
ans = min(ans, more+less)
print(ans)
convexineq