結果

問題 No.2029 Swap Min Max Min
ユーザー 沙耶花沙耶花
提出日時 2022-08-05 21:28:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 643 bytes
コンパイル時間 5,510 ms
コンパイル使用メモリ 259,956 KB
実行使用メモリ 5,220 KB
最終ジャッジ日時 2023-10-14 00:03:22
合計ジャッジ時間 9,133 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 19 ms
4,348 KB
testcase_06 AC 38 ms
4,712 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 11 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 25 ms
4,352 KB
testcase_13 WA -
testcase_14 AC 56 ms
4,952 KB
testcase_15 WA -
testcase_16 AC 56 ms
4,936 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 56 ms
4,860 KB
testcase_20 AC 57 ms
4,832 KB
testcase_21 AC 56 ms
4,952 KB
testcase_22 AC 56 ms
4,832 KB
testcase_23 AC 58 ms
5,048 KB
testcase_24 AC 57 ms
5,220 KB
testcase_25 AC 57 ms
4,920 KB
testcase_26 AC 57 ms
5,004 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 WA -
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 1 ms
4,348 KB
testcase_35 AC 1 ms
4,352 KB
testcase_36 AC 1 ms
4,356 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 49 ms
4,764 KB
testcase_39 AC 55 ms
4,784 KB
testcase_40 AC 48 ms
4,792 KB
testcase_41 AC 52 ms
5,016 KB
testcase_42 AC 52 ms
4,844 KB
testcase_43 AC 54 ms
4,860 KB
testcase_44 AC 57 ms
4,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int main() {
    
	int N;
	cin>>N;
	
	
	
	vector<int> a(N);
	vector pos(2,vector<int>());
	rep(i,N){
		cin>>a[i];
		if(a[i]<=N/2)pos[0].push_back(i);
		else pos[1].push_back(i);
	}
	
	long long ans = 1000000000000000000;
	rep(i,2){
		if(pos[i].size()==(N+1)/2){
			long long sum = 0;
			for(int j=0;j<=N-1;j+=2){
				sum += abs(pos[i][j/2]-j);
			}
			ans = min(ans,sum);
		}
	}
	cout<<N/2<<' ';
	cout<<ans<<endl;
    return 0;
}
0