結果

問題 No.2029 Swap Min Max Min
ユーザー 👑 KazunKazun
提出日時 2022-08-05 23:03:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 114,320 KB
最終ジャッジ日時 2023-10-14 00:47:35
合計ジャッジ時間 7,014 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,916 KB
testcase_01 AC 70 ms
71,024 KB
testcase_02 AC 69 ms
71,044 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 92 ms
86,696 KB
testcase_06 AC 111 ms
101,240 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 87 ms
80,132 KB
testcase_11 WA -
testcase_12 AC 98 ms
90,688 KB
testcase_13 WA -
testcase_14 AC 126 ms
108,364 KB
testcase_15 WA -
testcase_16 AC 128 ms
114,320 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 124 ms
108,088 KB
testcase_20 AC 126 ms
108,164 KB
testcase_21 AC 127 ms
107,788 KB
testcase_22 AC 126 ms
113,820 KB
testcase_23 AC 125 ms
114,068 KB
testcase_24 AC 122 ms
108,244 KB
testcase_25 AC 122 ms
114,268 KB
testcase_26 AC 120 ms
108,456 KB
testcase_27 AC 70 ms
70,968 KB
testcase_28 AC 71 ms
70,976 KB
testcase_29 AC 70 ms
70,888 KB
testcase_30 AC 70 ms
70,820 KB
testcase_31 AC 71 ms
71,000 KB
testcase_32 WA -
testcase_33 AC 70 ms
70,884 KB
testcase_34 WA -
testcase_35 AC 71 ms
70,808 KB
testcase_36 AC 71 ms
70,820 KB
testcase_37 AC 71 ms
70,800 KB
testcase_38 AC 117 ms
109,396 KB
testcase_39 AC 123 ms
114,100 KB
testcase_40 AC 116 ms
109,312 KB
testcase_41 AC 119 ms
110,200 KB
testcase_42 AC 122 ms
110,180 KB
testcase_43 AC 121 ms
113,932 KB
testcase_44 AC 123 ms
108,104 KB
権限があれば一括ダウンロードができます

ソースコード

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:
        for i,t in enumerate(T,1):
            Y+=min(abs(2*i-t), abs(2*i-1-t))

    print(X,Y)

solve()
0