Submission #3293387


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;


#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

const int mod = 1e9 + 7;
const int N = 700012;
const int inf = 2e9;
typedef long long ll;
int n;
map<int, int> cnt1, cnt2;
int a[N];
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    fo(i, n) cin >> a[i];
    for(int i = 1; i <= n; i += 2)
        cnt1[a[i]]++;
    for(int i = 2; i <= n; i += 2)
        cnt2[a[i]]++;
    cnt1[0] = 0;
    cnt2[0] = 0;
    int c = 0;
    int ans = 0;
    for(auto x : cnt1) {
        ++c;
        if(c > 4) break;
        for(auto y : cnt2) {
            if(x.first != y.first) ans = max(ans, x.second + y.second);
        }
    }
    cout << n - ans;
    return 0;
}

Submission Info

Submission Time
Task C - /\/\/\/
User Speedster
Language C++14 (GCC 5.4.1)
Score 0
Code Size 775 Byte
Status
Exec Time 41 ms
Memory 5376 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1_3132.txt, sample2_iw.txt, sample3_1111.txt
All 0 / 300 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 22 ms 2944 KB
ababa_1.txt 25 ms 2944 KB
eq_0.txt 10 ms 640 KB
eq_1.txt 9 ms 640 KB
rnd_17.txt 9 ms 640 KB
sample1_3132.txt 1 ms 256 KB
sample2_iw.txt 1 ms 256 KB
sample3_1111.txt 1 ms 256 KB
top2_0.txt 14 ms 1024 KB
top2_1.txt 14 ms 1024 KB
top2_2.txt 14 ms 1024 KB
top2_3.txt 14 ms 1024 KB
top2modoki_0.txt 14 ms 1024 KB
top2modoki_1.txt 14 ms 1024 KB
top2modoki_2.txt 14 ms 1024 KB
top2modoki_3.txt 14 ms 1024 KB
vary_1.txt 41 ms 5376 KB
vary_2.txt 41 ms 5248 KB
vary_3.txt 31 ms 3712 KB
zoro_0.txt 1 ms 256 KB