結果
| 問題 | No.198 キャンディー・ボックス2 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-12-18 18:43:16 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 29 ms / 1,000 ms |
| + 593µs | |
| コード長 | 263 bytes |
| 記録 | |
| コンパイル時間 | 76 ms |
| コンパイル使用メモリ | 82,148 KB |
| 実行使用メモリ | 56,364 KB |
| 最終ジャッジ日時 | 2026-10-10 15:29:44 |
| 合計ジャッジ時間 | 2,836 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
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