結果

問題 No.2029 Swap Min Max Min
ユーザー ああいいああいい
提出日時 2022-08-07 17:39:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 81,628 KB
実行使用メモリ 117,620 KB
最終ジャッジ日時 2023-10-17 12:25:00
合計ジャッジ時間 7,471 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,380 KB
testcase_01 AC 38 ms
53,380 KB
testcase_02 AC 39 ms
53,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 65 ms
82,040 KB
testcase_06 AC 84 ms
100,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 56 ms
72,828 KB
testcase_11 WA -
testcase_12 AC 68 ms
86,500 KB
testcase_13 WA -
testcase_14 AC 101 ms
111,720 KB
testcase_15 WA -
testcase_16 AC 99 ms
111,624 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 99 ms
111,660 KB
testcase_20 AC 99 ms
111,720 KB
testcase_21 AC 99 ms
111,672 KB
testcase_22 AC 98 ms
111,624 KB
testcase_23 AC 89 ms
110,768 KB
testcase_24 AC 88 ms
110,808 KB
testcase_25 AC 95 ms
112,084 KB
testcase_26 AC 96 ms
111,820 KB
testcase_27 AC 39 ms
53,396 KB
testcase_28 AC 39 ms
53,396 KB
testcase_29 AC 38 ms
53,396 KB
testcase_30 AC 39 ms
53,396 KB
testcase_31 AC 39 ms
53,396 KB
testcase_32 WA -
testcase_33 AC 38 ms
53,396 KB
testcase_34 WA -
testcase_35 AC 38 ms
53,396 KB
testcase_36 AC 38 ms
53,396 KB
testcase_37 AC 38 ms
53,396 KB
testcase_38 AC 84 ms
104,544 KB
testcase_39 AC 96 ms
111,660 KB
testcase_40 AC 89 ms
111,064 KB
testcase_41 AC 85 ms
105,076 KB
testcase_42 AC 83 ms
105,144 KB
testcase_43 AC 96 ms
117,620 KB
testcase_44 AC 88 ms
110,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


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

import sys
if N % 2 == 1:
    X = N // 2
    print(N // 2,end = " ")
    l = []
    for i in range(N):
        if A[i] <= X:
            l.append(i)
    tmp = []
    for i in range(N):
        if i & 1 == 1:
            tmp.append(i)
    ans = 0
    for k in range(len(l)):
        ans += abs(l[k] - tmp[k])
    print(ans)
    exit()

X = N // 2
print(X,end = " ")
l = []
for i in range(N):
    if A[i] <= X:
        l.append(i)
ans = 0
for i in range(X):
    ans += min(abs(i * 2 - l[i]),abs(i * 2 + 1 - l[i]))
print(ans)
0