結果

問題 No.1374 Absolute Game
ユーザー ytftytft
提出日時 2022-03-18 11:02:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 86,896 KB
最終ジャッジ日時 2024-04-10 12:00:20
合計ジャッジ時間 2,825 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
52,336 KB
testcase_01 AC 31 ms
52,352 KB
testcase_02 AC 32 ms
53,620 KB
testcase_03 AC 31 ms
52,860 KB
testcase_04 AC 30 ms
52,556 KB
testcase_05 AC 30 ms
51,760 KB
testcase_06 AC 30 ms
53,888 KB
testcase_07 AC 30 ms
53,348 KB
testcase_08 AC 42 ms
66,460 KB
testcase_09 AC 61 ms
80,440 KB
testcase_10 AC 69 ms
83,292 KB
testcase_11 AC 53 ms
74,568 KB
testcase_12 AC 44 ms
67,504 KB
testcase_13 AC 57 ms
77,676 KB
testcase_14 AC 69 ms
85,816 KB
testcase_15 AC 73 ms
85,984 KB
testcase_16 AC 72 ms
86,356 KB
testcase_17 AC 72 ms
85,760 KB
testcase_18 AC 69 ms
86,896 KB
testcase_19 AC 71 ms
85,536 KB
testcase_20 AC 44 ms
69,356 KB
testcase_21 AC 51 ms
72,640 KB
testcase_22 AC 69 ms
85,660 KB
testcase_23 AC 36 ms
61,708 KB
testcase_24 AC 37 ms
63,240 KB
testcase_25 AC 39 ms
63,540 KB
testcase_26 AC 45 ms
67,568 KB
testcase_27 AC 49 ms
71,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda:sys.stdin.readline().rstrip()
N=int(input())
A=sorted(list(map(int,input().split())))
if N==1:
	print(abs(A[0]))
elif sum(A)>0:
	print(abs(sum(A[N-1::-2]))-abs(sum(A[N-2::-2])))
else:
	print(abs(sum(A[::2]))-abs(sum(A[1::2])))
0