結果
問題 | No.1374 Absolute Game |
ユーザー | 👑 SPD_9X2 |
提出日時 | 2021-02-05 21:39:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 682 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 87,120 KB |
実行使用メモリ | 92,724 KB |
最終ジャッジ日時 | 2023-09-15 07:27:40 |
合計ジャッジ時間 | 4,479 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,212 KB |
testcase_01 | AC | 72 ms
71,204 KB |
testcase_02 | AC | 72 ms
71,324 KB |
testcase_03 | AC | 71 ms
71,380 KB |
testcase_04 | AC | 71 ms
71,296 KB |
testcase_05 | AC | 72 ms
71,440 KB |
testcase_06 | AC | 72 ms
71,292 KB |
testcase_07 | AC | 72 ms
71,204 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
ソースコード
""" """ import sys from sys import stdin N = int(stdin.readline()) c = list(map(int,stdin.readline().split())) c.sort() a = 0 b = 0 for i in range(N): if i % 2 == 0: a += c[i] else: b += c[i] ans = abs(a)-abs(b) print (a,b,file=sys.stderr) c.reverse() a = 0 b = 0 for i in range(N): if i % 2 == 0: a += c[i] else: b += c[i] ans = max(ans , abs(a)-abs(b)) print (a,b,file=sys.stderr) c.reverse() a = sum(c[:(N+1)//2]) b = sum(c[(N+1)//2:]) ans = max(ans , abs(a)-abs(b)) print (a,b,file=sys.stderr) c.reverse() a = sum(c[:(N+1)//2]) b = sum(c[(N+1)//2:]) ans = max(ans , abs(a)-abs(b)) print (a,b,file=sys.stderr) print (ans)