結果
| 問題 | No.2029 Swap Min Max Min |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-08-05 21:28:44 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 643 bytes |
| 記録 | |
| コンパイル時間 | 3,028 ms |
| コンパイル使用メモリ | 274,288 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-26 22:06:30 |
| 合計ジャッジ時間 | 5,220 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 31 WA * 11 |
ソースコード
#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;
}
沙耶花