-
Notifications
You must be signed in to change notification settings - Fork 3
/
AlternantArray.cpp
62 lines (57 loc) · 964 Bytes
/
AlternantArray.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vl;
typedef std::vector<vl> vvl;
void read(ll &x){
scanf("%lld",&x);
}
void read(ll &x,ll &y){
scanf("%lld%lld",&x,&y);
}
void read(ll &x,ll &y,ll &z){
scanf("%lld%lld%lld",&x,&y,&z);
}
void read(ll &x,ll &y,ll &z,ll &w){
scanf("%lld%lld%lld%lld",&x,&y,&z,&w);
}
clock_t t_start,t_end;
void start_clock(){
t_start = clock();
}
void end_clock(){
t_end = clock();
ld timeis = t_end - t_start;
printf("\n\nTime taken : %f s", ((float)timeis)/CLOCKS_PER_SEC);
}
using namespace std;
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
start_clock();
ll n, o=0, z=0;
read(n);
n*=2;
while(n--){
ll i;
read(i);
if(n%2==0){
if(i==0)
o++;
else
z++;
}
else{
if(i==0)
z++;
else
o++;
}
}
printf("%lld\n", min(z/2, o/2));
end_clock();
return 0;
}