結果

問題 No.1374 Absolute Game
ユーザー persimmon-persimmon
提出日時 2021-06-18 12:49:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 255 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 90,716 KB
最終ジャッジ日時 2024-06-22 03:59:19
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
c=list(map(int,input().split()))
c.sort()
a=sum([abs(x) for x in c[:n//2]])
b=sum([abs(x) for x in c[n//2:]])
ans0=abs(a-b)
c.reverse()
a=sum([abs(x) for x in c[:n//2]])
b=sum([abs(x) for x in c[n//2:]])
ans1=abs(a-b)

print(min(ans0,ans1))
0