結果
| 問題 | No.1374 Absolute Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-02 16:28:46 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 277 bytes |
| 記録 | |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 91,904 KB |
| 最終ジャッジ日時 | 2026-04-19 05:02:37 |
| 合計ジャッジ時間 | 6,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
c = list(map(int, input().split()))
if sum(c)<0:
c = list(map(lambda x: -x, c))
c.sort(reverse=True)
a, b = 0, 0
for i in range(N):
if i%2==0:
a += c[i]
else:
b += c[i]
print(abs(a)-abs(b))