結果

問題 No.2029 Swap Min Max Min
ユーザー ntudantuda
提出日時 2022-08-09 23:30:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,632 KB
実行使用メモリ 103,536 KB
最終ジャッジ日時 2023-10-20 08:55:44
合計ジャッジ時間 6,396 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,404 KB
testcase_01 AC 39 ms
53,404 KB
testcase_02 AC 39 ms
53,404 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 60 ms
74,852 KB
testcase_06 AC 74 ms
90,668 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 53 ms
67,852 KB
testcase_11 WA -
testcase_12 AC 65 ms
80,012 KB
testcase_13 WA -
testcase_14 AC 90 ms
103,156 KB
testcase_15 WA -
testcase_16 AC 87 ms
102,632 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 87 ms
102,680 KB
testcase_20 AC 88 ms
102,852 KB
testcase_21 AC 89 ms
102,992 KB
testcase_22 AC 89 ms
102,632 KB
testcase_23 AC 85 ms
102,896 KB
testcase_24 AC 84 ms
103,032 KB
testcase_25 AC 84 ms
102,892 KB
testcase_26 AC 83 ms
102,896 KB
testcase_27 AC 38 ms
53,404 KB
testcase_28 AC 39 ms
53,404 KB
testcase_29 AC 39 ms
53,404 KB
testcase_30 AC 39 ms
53,404 KB
testcase_31 AC 39 ms
53,404 KB
testcase_32 WA -
testcase_33 AC 39 ms
53,404 KB
testcase_34 WA -
testcase_35 AC 39 ms
53,404 KB
testcase_36 AC 39 ms
53,404 KB
testcase_37 AC 39 ms
53,404 KB
testcase_38 AC 80 ms
99,004 KB
testcase_39 AC 84 ms
102,668 KB
testcase_40 AC 79 ms
96,936 KB
testcase_41 AC 82 ms
99,296 KB
testcase_42 AC 80 ms
99,316 KB
testcase_43 AC 83 ms
102,504 KB
testcase_44 AC 84 ms
102,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
X = N // 2
if N & 1:
    st = 1
    Y = 0
    for i,a in enumerate(A):
        if a <= X:
            Y += abs(st-i)
            st += 2
else:
    st = 0
    Y = 0
    for i,a in enumerate(A):
        if a <= X:
            Y += min(abs(st-i),abs(st+1-i))
            st += 2
print(X,Y)
0