結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,484 KB
testcase_01 AC 73 ms
71,172 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 94 ms
86,576 KB
testcase_06 AC 109 ms
101,068 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 85 ms
80,352 KB
testcase_11 WA -
testcase_12 AC 97 ms
90,328 KB
testcase_13 WA -
testcase_14 AC 123 ms
107,064 KB
testcase_15 WA -
testcase_16 AC 123 ms
112,836 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 121 ms
106,780 KB
testcase_20 AC 122 ms
106,952 KB
testcase_21 AC 123 ms
106,928 KB
testcase_22 AC 124 ms
112,812 KB
testcase_23 WA -
testcase_24 AC 119 ms
107,028 KB
testcase_25 AC 121 ms
112,968 KB
testcase_26 AC 119 ms
107,072 KB
testcase_27 WA -
testcase_28 AC 71 ms
71,164 KB
testcase_29 AC 71 ms
71,132 KB
testcase_30 AC 72 ms
71,328 KB
testcase_31 AC 74 ms
71,368 KB
testcase_32 WA -
testcase_33 AC 73 ms
71,284 KB
testcase_34 WA -
testcase_35 AC 72 ms
71,356 KB
testcase_36 AC 72 ms
71,460 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 120 ms
112,876 KB
testcase_40 AC 113 ms
108,528 KB
testcase_41 AC 117 ms
109,384 KB
testcase_42 AC 118 ms
108,992 KB
testcase_43 AC 119 ms
112,964 KB
testcase_44 AC 117 ms
106,960 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