結果

問題 No.2029 Swap Min Max Min
ユーザー first_vilfirst_vil
提出日時 2022-08-05 21:40:08
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 746 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 119,044 KB
最終ジャッジ日時 2023-10-14 00:05:59
合計ジャッジ時間 7,541 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,344 KB
testcase_01 AC 79 ms
71,276 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 107 ms
88,372 KB
testcase_06 AC 124 ms
101,192 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 93 ms
80,788 KB
testcase_11 WA -
testcase_12 AC 106 ms
90,756 KB
testcase_13 WA -
testcase_14 AC 146 ms
111,048 KB
testcase_15 WA -
testcase_16 AC 146 ms
111,148 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 146 ms
111,196 KB
testcase_20 AC 144 ms
111,408 KB
testcase_21 AC 148 ms
111,296 KB
testcase_22 AC 148 ms
111,060 KB
testcase_23 AC 153 ms
118,596 KB
testcase_24 AC 152 ms
118,808 KB
testcase_25 AC 141 ms
111,756 KB
testcase_26 AC 142 ms
111,580 KB
testcase_27 AC 76 ms
71,292 KB
testcase_28 AC 78 ms
71,340 KB
testcase_29 AC 77 ms
71,536 KB
testcase_30 AC 76 ms
71,176 KB
testcase_31 AC 76 ms
71,300 KB
testcase_32 WA -
testcase_33 AC 76 ms
71,092 KB
testcase_34 AC 76 ms
71,160 KB
testcase_35 AC 75 ms
71,208 KB
testcase_36 AC 77 ms
71,392 KB
testcase_37 AC 76 ms
71,520 KB
testcase_38 AC 136 ms
103,504 KB
testcase_39 AC 141 ms
111,208 KB
testcase_40 AC 129 ms
103,148 KB
testcase_41 AC 142 ms
113,752 KB
testcase_42 AC 142 ms
113,840 KB
testcase_43 AC 137 ms
110,800 KB
testcase_44 AC 152 ms
118,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush
import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353

n = ii()
a = li()

b = [i for i in range(n) if a[i] <= n // 2]
b.sort()
c = [2 * i + 1 for i in range(n // 2)]
ans = sum([abs(x - y) for x, y in zip(b, c)])
if ~n & 1:
    c = [2 * i for i in range(n // 2)]
    ans = min(ans, sum([abs(x - y) for x, y in zip(b, c)]))
print(n // 2, ans)
0