結果

問題 No.837 Noelちゃんと星々2
ユーザー O2MT
提出日時 2020-08-24 16:35:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 23,884 KB
最終ジャッジ日時 2024-11-06 10:23:50
合計ジャッジ時間 4,480 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 2 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from math import ceil
N = int(input())
Y = list(map(int,input().split()))
X = list(set(Y))
if len(X) == 1:
  print(1)
  exit()
if len(X) == 2:
  print(0)
  exit()
Y.sort()
S = list(accumulate(Y))
ans = 10**18

for i in range(N-1):
  ans = min(ans, S[(N-1+i)//2]-S[i+1]-(S[i+1]-S[i//2+1]) if N%2==0 else S[(N-1+i)//2]-S[i+1]-(S[i]-S[i//2+1]))
print(ans) 
0