結果

問題 No.2029 Swap Min Max Min
ユーザー ShirotsumeShirotsume
提出日時 2022-07-04 01:10:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 30,936 KB
最終ジャッジ日時 2023-10-14 00:02:47
合計ジャッジ時間 5,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,876 KB
testcase_01 AC 16 ms
7,968 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 45 ms
15,600 KB
testcase_06 AC 75 ms
23,284 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 32 ms
12,272 KB
testcase_11 WA -
testcase_12 AC 54 ms
18,188 KB
testcase_13 WA -
testcase_14 AC 102 ms
30,764 KB
testcase_15 WA -
testcase_16 AC 101 ms
29,944 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 103 ms
30,084 KB
testcase_20 AC 104 ms
30,548 KB
testcase_21 AC 104 ms
30,124 KB
testcase_22 AC 102 ms
30,012 KB
testcase_23 AC 115 ms
29,936 KB
testcase_24 AC 112 ms
30,016 KB
testcase_25 AC 102 ms
30,008 KB
testcase_26 AC 101 ms
29,968 KB
testcase_27 AC 16 ms
7,900 KB
testcase_28 AC 17 ms
7,820 KB
testcase_29 AC 16 ms
7,800 KB
testcase_30 AC 16 ms
7,960 KB
testcase_31 AC 17 ms
7,796 KB
testcase_32 WA -
testcase_33 AC 16 ms
7,908 KB
testcase_34 AC 16 ms
7,924 KB
testcase_35 AC 17 ms
7,856 KB
testcase_36 AC 16 ms
7,836 KB
testcase_37 AC 16 ms
7,800 KB
testcase_38 AC 103 ms
26,944 KB
testcase_39 AC 105 ms
30,112 KB
testcase_40 AC 91 ms
26,848 KB
testcase_41 AC 106 ms
29,244 KB
testcase_42 AC 104 ms
29,348 KB
testcase_43 AC 96 ms
29,596 KB
testcase_44 AC 112 ms
30,936 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