-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathcupboards.cpp
68 lines (54 loc) · 1.17 KB
/
cupboards.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
63
64
65
66
67
68
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int l[n];
int r[n];
//int one=0, two=0, zero=0, three=0;
for(int i=0; i<n;i++){
cin>>l[i]>>r[i];
// cin>>l>>r;
// //check_num(l, r);
// if(l==0 && r==0){
// zero++;
// }else if(l==1 && r==0){
// two++;
// }else if(l==0 && r==1){
// one++;
// }else{
// three++;
// }
}
int l_one = 0, l_zero = 0, r_one=0, r_zero=0;
for(int i= 0; i<n; i++){
if(l[i] == 0){
l_zero++;
if(r[i] == 0){
r_zero++;
}else if(r[i] == 1){
r_one++;
}
}else{
l_one++;
if(r[i] == 0){
r_zero++;
}else if(r[i] == 1){
r_one++;
}
}
}
int ans = 0;
if(l_zero > l_one){
ans += l_one;
}else{
ans += l_zero;
}
if(r_zero > r_one){
ans += r_one;
}else{
ans += r_zero;
}
cout<<ans<<endl;
return 0;
}