結果

問題 No.1374 Absolute Game
ユーザー tassei903tassei903
提出日時 2021-02-05 22:40:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 19,260 KB
最終ジャッジ日時 2023-09-15 09:19:40
合計ジャッジ時間 4,504 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,772 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 15 ms
7,856 KB
testcase_03 AC 16 ms
7,908 KB
testcase_04 AC 16 ms
7,976 KB
testcase_05 AC 15 ms
7,776 KB
testcase_06 AC 15 ms
7,836 KB
testcase_07 AC 16 ms
7,956 KB
testcase_08 AC 55 ms
11,288 KB
testcase_09 AC 122 ms
16,376 KB
testcase_10 AC 139 ms
17,476 KB
testcase_11 AC 88 ms
13,676 KB
testcase_12 AC 59 ms
11,836 KB
testcase_13 AC 111 ms
15,336 KB
testcase_14 AC 162 ms
19,248 KB
testcase_15 AC 166 ms
19,120 KB
testcase_16 AC 165 ms
19,132 KB
testcase_17 AC 160 ms
19,244 KB
testcase_18 AC 161 ms
19,260 KB
testcase_19 AC 166 ms
19,124 KB
testcase_20 AC 64 ms
12,144 KB
testcase_21 AC 84 ms
13,612 KB
testcase_22 AC 158 ms
18,692 KB
testcase_23 AC 29 ms
9,388 KB
testcase_24 AC 35 ms
9,752 KB
testcase_25 AC 40 ms
10,340 KB
testcase_26 AC 59 ms
11,700 KB
testcase_27 AC 78 ms
12,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c  = list(map(int,input().split()))
d = sorted(c)
a = [0,0,0,0]
b = [0,0,0,0]
for i in range(n):
    if i%2==0:
        a[0]+=d[i]
        a[1]+=d[i//2]
        a[2]+=d[-1-i]
        a[3]+=d[-1-i//2]
    else:
        b[0]+=d[i]
        b[1]+=d[-1-i//2]
        b[2]+=d[-1-i]
        b[3]+=d[i//2]
print(abs(abs(a[0])-abs(b[0])))
0