Submission #3816714
Source Code Expand
#include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define PB push_back #define MP make_pair #define INF int(1e9+7) using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef vector<int> vi; int a[100005], b[100005]; int main() { IO_OP; int n; cin >> n; for(int i=0;i<n;i++) { int t; cin >> t; if(i&1) b[t]++; else a[t]++; } vector<pi> u, v; for(int i=0;i<100005;i++) { u.PB({a[i], i}); v.PB({b[i], i}); } sort(u.begin(), u.end()); sort(v.begin(), v.end()); reverse(u.begin(), u.end()); reverse(v.begin(), v.end()); if(u[0].S != v[0].S) { cout << n - (u[0].F + v[0].F) << endl; } else { cout << n - max(u[0].F + v[1].F, u[1].F + v[0].F) << endl; } }
Submission Info
Submission Time | |
---|---|
Task | C - /\/\/\/ |
User | cheissmart |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 820 Byte |
Status | AC |
Exec Time | 33 ms |
Memory | 2804 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 21 ms | 2420 KB |
ababa_1.txt | AC | 21 ms | 2420 KB |
eq_0.txt | AC | 33 ms | 2160 KB |
eq_1.txt | AC | 32 ms | 2164 KB |
rnd_17.txt | AC | 33 ms | 2164 KB |
sample1_3132.txt | AC | 18 ms | 2036 KB |
sample2_iw.txt | AC | 9 ms | 2036 KB |
sample3_1111.txt | AC | 9 ms | 2036 KB |
top2_0.txt | AC | 22 ms | 2804 KB |
top2_1.txt | AC | 23 ms | 2804 KB |
top2_2.txt | AC | 22 ms | 2804 KB |
top2_3.txt | AC | 23 ms | 2804 KB |
top2modoki_0.txt | AC | 23 ms | 2804 KB |
top2modoki_1.txt | AC | 23 ms | 2804 KB |
top2modoki_2.txt | AC | 22 ms | 2804 KB |
top2modoki_3.txt | AC | 23 ms | 2804 KB |
vary_1.txt | AC | 25 ms | 2804 KB |
vary_2.txt | AC | 25 ms | 2804 KB |
vary_3.txt | AC | 25 ms | 2804 KB |
zoro_0.txt | AC | 10 ms | 2036 KB |