結果

問題 No.1374 Absolute Game
ユーザー 👑 KazunKazun
提出日時 2021-02-05 21:42:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 98,344 KB
最終ジャッジ日時 2023-09-15 07:31:10
合計ジャッジ時間 5,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,812 KB
testcase_01 AC 96 ms
71,852 KB
testcase_02 AC 94 ms
71,700 KB
testcase_03 AC 93 ms
71,936 KB
testcase_04 AC 95 ms
71,672 KB
testcase_05 AC 93 ms
71,688 KB
testcase_06 AC 93 ms
71,672 KB
testcase_07 AC 93 ms
71,856 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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from collections import deque

N=int(input())
C=list(map(int,input().split()))
C.sort()

T=[]
for i,j in product([0,1],repeat=2):
    Q=deque(C[:])
    a=b=0
    for k in range(N):
        if k%2==0:
            if i==0:
                x=Q.popleft()
            else:
                x=Q.pop()
            a+=x
        else:
            if j==0:
                y=Q.popleft()
            else:
                y=Q.pop()
            b+=y
    T.append(abs(a)-abs(b))

print(max(T))
0