結果

問題 No.2029 Swap Min Max Min
ユーザー aoymats1aoymats1
提出日時 2022-08-05 22:34:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 107,452 KB
最終ジャッジ日時 2023-10-14 00:12:47
合計ジャッジ時間 6,908 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,084 KB
testcase_01 AC 72 ms
71,232 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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 AC 120 ms
107,440 KB
testcase_24 AC 119 ms
107,328 KB
testcase_25 AC 119 ms
107,320 KB
testcase_26 AC 120 ms
107,336 KB
testcase_27 AC 72 ms
71,224 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 72 ms
71,436 KB
testcase_34 WA -
testcase_35 AC 72 ms
71,568 KB
testcase_36 AC 72 ms
71,400 KB
testcase_37 AC 73 ms
71,300 KB
testcase_38 AC 114 ms
103,208 KB
testcase_39 AC 116 ms
106,768 KB
testcase_40 AC 111 ms
103,268 KB
testcase_41 AC 113 ms
103,464 KB
testcase_42 AC 115 ms
103,608 KB
testcase_43 AC 117 ms
106,884 KB
testcase_44 AC 120 ms
107,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

X = N // 2
sum_00 = 0
sum_01 = 0
sum_10 = 0
sum_11 = 0
for i in range(N):
    if A[i] <= X:
        if i & 1: sum_01 += i
        else: sum_00 += i
    else:
        if i & 1: sum_11 += i
        else: sum_10 += i

if N & 1: Y = abs(sum_00 - sum_11)
else: Y = min(abs(sum_01 - sum_10), abs(sum_00 - sum_11))

print(X, Y)
0