結果
問題 |
No.1374 Absolute Game
|
ユーザー |
|
提出日時 | 2021-02-27 11:37:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 223 bytes |
コンパイル時間 | 534 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 86,528 KB |
最終ジャッジ日時 | 2024-10-02 17:24:36 |
合計ジャッジ時間 | 3,231 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
n = int(input()) a = list(map(int,input().split())) if sum(a) < 0: a = [-1*i for i in a] a.sort(reverse=True) A = 0 B = 0 for i in range(n): if i%2: B += a[i] else: A += a[i] print(abs(A)-abs(B))