結果

問題 No.2029 Swap Min Max Min
ユーザー ShirotsumeShirotsume
提出日時 2022-07-03 01:01:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 3,769 ms
コンパイル使用メモリ 227,308 KB
実行使用メモリ 4,852 KB
最終ジャッジ日時 2023-10-14 00:01:58
合計ジャッジ時間 7,062 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,356 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 19 ms
4,352 KB
testcase_06 AC 37 ms
4,556 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 12 ms
4,352 KB
testcase_11 WA -
testcase_12 AC 25 ms
4,356 KB
testcase_13 WA -
testcase_14 AC 56 ms
4,436 KB
testcase_15 WA -
testcase_16 AC 55 ms
4,620 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 55 ms
4,424 KB
testcase_20 AC 57 ms
4,432 KB
testcase_21 AC 55 ms
4,780 KB
testcase_22 AC 55 ms
4,416 KB
testcase_23 AC 56 ms
4,456 KB
testcase_24 AC 57 ms
4,516 KB
testcase_25 AC 57 ms
4,648 KB
testcase_26 AC 56 ms
4,852 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 1 ms
4,352 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 WA -
testcase_33 AC 1 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,352 KB
testcase_37 AC 2 ms
4,352 KB
testcase_38 AC 49 ms
4,388 KB
testcase_39 AC 54 ms
4,468 KB
testcase_40 AC 48 ms
4,352 KB
testcase_41 AC 52 ms
4,580 KB
testcase_42 AC 51 ms
4,388 KB
testcase_43 AC 53 ms
4,536 KB
testcase_44 AC 56 ms
4,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; i++)
int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll x, y;
    x = n / 2;
    vector<int> ind;
    rep(i, n){
        if (a[i] <= x) ind.push_back(i);
    }
    if(n % 2){
        y = 0;
        rep(i, x){
            y += abs(ind[i] - 2 * i - 1);
        }
    }
    else{
        ll y1 = 0;
        ll y2 = 0;
        rep(i, x){
            y1 += abs(ind[i] - 2 * i - 1);
            y2 += abs(ind[i] - 2 * i);
        }
        y = min(y1, y2);
    }
    cout << x << ' ' << y << endl;
    return 0;
}
0