結果

問題 No.2029 Swap Min Max Min
ユーザー ShirotsumeShirotsume
提出日時 2022-06-14 22:44:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 113,120 KB
最終ジャッジ日時 2023-10-14 00:01:16
合計ジャッジ時間 7,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,360 KB
testcase_01 AC 72 ms
71,552 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 92 ms
86,624 KB
testcase_06 AC 106 ms
100,956 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 88 ms
80,644 KB
testcase_11 WA -
testcase_12 AC 95 ms
90,352 KB
testcase_13 WA -
testcase_14 AC 119 ms
107,052 KB
testcase_15 WA -
testcase_16 AC 126 ms
112,828 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 121 ms
106,844 KB
testcase_20 AC 121 ms
107,176 KB
testcase_21 AC 121 ms
107,156 KB
testcase_22 AC 123 ms
112,932 KB
testcase_23 WA -
testcase_24 AC 117 ms
107,012 KB
testcase_25 AC 119 ms
112,824 KB
testcase_26 AC 116 ms
107,012 KB
testcase_27 WA -
testcase_28 AC 71 ms
71,364 KB
testcase_29 AC 72 ms
71,368 KB
testcase_30 AC 70 ms
71,276 KB
testcase_31 AC 72 ms
71,396 KB
testcase_32 WA -
testcase_33 AC 73 ms
71,332 KB
testcase_34 WA -
testcase_35 AC 71 ms
71,084 KB
testcase_36 AC 71 ms
71,364 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 118 ms
113,120 KB
testcase_40 AC 113 ms
108,592 KB
testcase_41 AC 116 ms
109,148 KB
testcase_42 AC 118 ms
109,028 KB
testcase_43 AC 119 ms
112,964 KB
testcase_44 AC 116 ms
106,716 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 = y1
    return x, y

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

print(*solve(n, a))
0