結果

問題 No.2029 Swap Min Max Min
ユーザー 👑 KazunKazun
提出日時 2022-08-05 23:10:32
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 343 bytes
コンパイル時間 2,067 ms
コンパイル使用メモリ 86,596 KB
実行使用メモリ 114,612 KB
最終ジャッジ日時 2023-10-14 00:57:15
合計ジャッジ時間 10,538 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,116 KB
testcase_01 AC 68 ms
71,160 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 91 ms
87,040 KB
testcase_06 AC 111 ms
101,936 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 85 ms
80,860 KB
testcase_11 RE -
testcase_12 AC 97 ms
90,920 KB
testcase_13 RE -
testcase_14 AC 126 ms
108,576 KB
testcase_15 RE -
testcase_16 AC 129 ms
114,520 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 127 ms
108,488 KB
testcase_20 AC 128 ms
108,468 KB
testcase_21 AC 129 ms
108,408 KB
testcase_22 AC 128 ms
114,248 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 126 ms
114,612 KB
testcase_26 AC 121 ms
108,584 KB
testcase_27 RE -
testcase_28 AC 69 ms
71,128 KB
testcase_29 AC 70 ms
71,244 KB
testcase_30 AC 69 ms
71,508 KB
testcase_31 AC 71 ms
71,456 KB
testcase_32 RE -
testcase_33 AC 71 ms
71,128 KB
testcase_34 RE -
testcase_35 AC 70 ms
71,420 KB
testcase_36 AC 71 ms
71,344 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 124 ms
114,524 KB
testcase_40 AC 115 ms
109,796 KB
testcase_41 RE -
testcase_42 RE -
testcase_43 AC 120 ms
114,488 KB
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N=int(input())
    A=[-1]+list(map(int,input().split()))

    X=N//2; Y=0

    T=[i for i in range(1,N+1) if A[i]<=X]

    if N%2==1:
        for i,t in enumerate(T,1):
            Y+=abs(2*i-t)
    else:
        assert 0
        for i,t in enumerate(T,1):
            Y+=min(abs(2*i-t), abs(2*i-1-t))

    print(X,Y)

solve()
0