結果

問題 No.2029 Swap Min Max Min
ユーザー ShirotsumeShirotsume
提出日時 2022-06-14 22:43:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 113,208 KB
最終ジャッジ日時 2023-10-14 00:01:01
合計ジャッジ時間 6,968 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,140 KB
testcase_01 AC 72 ms
71,340 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 95 ms
86,172 KB
testcase_06 AC 113 ms
100,424 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 87 ms
80,520 KB
testcase_11 WA -
testcase_12 AC 98 ms
90,316 KB
testcase_13 WA -
testcase_14 AC 125 ms
107,116 KB
testcase_15 WA -
testcase_16 AC 130 ms
112,868 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 125 ms
106,740 KB
testcase_20 AC 125 ms
107,220 KB
testcase_21 AC 126 ms
107,060 KB
testcase_22 AC 127 ms
112,748 KB
testcase_23 AC 123 ms
112,980 KB
testcase_24 AC 120 ms
107,072 KB
testcase_25 AC 123 ms
112,872 KB
testcase_26 AC 119 ms
107,204 KB
testcase_27 AC 73 ms
71,372 KB
testcase_28 AC 75 ms
71,368 KB
testcase_29 AC 74 ms
71,280 KB
testcase_30 AC 74 ms
71,168 KB
testcase_31 AC 75 ms
71,284 KB
testcase_32 WA -
testcase_33 AC 74 ms
71,216 KB
testcase_34 AC 73 ms
71,332 KB
testcase_35 AC 74 ms
71,168 KB
testcase_36 AC 73 ms
71,364 KB
testcase_37 AC 74 ms
71,320 KB
testcase_38 AC 115 ms
108,144 KB
testcase_39 AC 126 ms
112,808 KB
testcase_40 AC 117 ms
108,532 KB
testcase_41 AC 117 ms
109,000 KB
testcase_42 AC 118 ms
109,048 KB
testcase_43 AC 120 ms
113,208 KB
testcase_44 AC 116 ms
106,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n, a):
    x = n // 2
    y = 0
    ind = []
    for i in range(n):
        if a[i] <= x:
            ind.append(i)
    if n % 2 == 1:
        for i, v in enumerate(ind):
            y += abs(v - (2 * i + 1))
    else:
        y1 = 0
        y2 = 0
        for i, v in enumerate(ind):
            y1 += abs(v - (2 * i + 1))
            y2 += abs(v - 2 * i)
        y = min(y1, y2)
    return x, y

n = int(input())
a = list(map(int,input().split()))

print(*solve(n, a))
0