結果
| 問題 | No.198 キャンディー・ボックス2 |
| コンテスト | |
| ユーザー |
あかりき
|
| 提出日時 | 2021-03-14 20:54:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 364 bytes |
| 記録 | |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 84,156 KB |
| 最終ジャッジ日時 | 2024-11-06 09:41:08 |
| 合計ジャッジ時間 | 3,145 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 9 RE * 3 |
ソースコード
b=int(input())
n=int(input())
c=[int(input()) for i in range(n)]
c.sort()
if n//2==1:
t=c[n//2]
else:
t=(c[n//2-1]+c[n//2])//2
x=sum(c)+b
ans=[]
for i in range(max(t-10**5,0),t+10**5):
if n*i<=x:
ct=0
for j in range(n):
if c[j]>=i:
ct+=c[j]-i
for j in range(n):
if c[j]<i:
ct+=i-c[j]
ans.append(ct)
print(min(ans))
あかりき