Submission #3769313


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n;
    cin >> n;
    map<int,int> mp[2];
    for(int i = 0; i < n; i++){
        int V;
        cin >> V;
        mp[i%2][V]++;
    }

    vector<P> v[2];
    for(int i = 0; i < 2; i++){
        for(auto j: mp[i]){
            v[i].emplace_back(j.second,j.first);
        }
        sort(v[i].rbegin(),v[i].rend());
        v[i].emplace_back(0,-1);
    }
    if(v[0][0].second == v[1][0].second){
        cout << min(n-v[0][0].first-v[1][1].first,n-v[0][1].first-v[1][0].first);
    }else{
        cout << n-v[0][0].first-v[1][0].first << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - /\/\/\/
User sai2o
Language C++14 (GCC 5.4.1)
Score 300
Code Size 760 Byte
Status AC
Exec Time 68 ms
Memory 6136 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample1_3132.txt, sample2_iw.txt, sample3_1111.txt
All ababa_0.txt, ababa_1.txt, eq_0.txt, eq_1.txt, rnd_17.txt, sample1_3132.txt, sample2_iw.txt, sample3_1111.txt, top2_0.txt, top2_1.txt, top2_2.txt, top2_3.txt, top2modoki_0.txt, top2modoki_1.txt, top2modoki_2.txt, top2modoki_3.txt, vary_1.txt, vary_2.txt, vary_3.txt, zoro_0.txt
Case Name Status Exec Time Memory
ababa_0.txt AC 48 ms 3196 KB
ababa_1.txt AC 47 ms 3196 KB
eq_0.txt AC 31 ms 256 KB
eq_1.txt AC 31 ms 256 KB
rnd_17.txt AC 31 ms 256 KB
sample1_3132.txt AC 1 ms 256 KB
sample2_iw.txt AC 1 ms 256 KB
sample3_1111.txt AC 1 ms 256 KB
top2_0.txt AC 35 ms 640 KB
top2_1.txt AC 35 ms 640 KB
top2_2.txt AC 36 ms 768 KB
top2_3.txt AC 35 ms 640 KB
top2modoki_0.txt AC 35 ms 640 KB
top2modoki_1.txt AC 34 ms 640 KB
top2modoki_2.txt AC 35 ms 640 KB
top2modoki_3.txt AC 35 ms 640 KB
vary_1.txt AC 68 ms 6136 KB
vary_2.txt AC 59 ms 6012 KB
vary_3.txt AC 53 ms 4344 KB
zoro_0.txt AC 1 ms 256 KB