-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcupboards.cpp
More file actions
43 lines (42 loc) · 775 Bytes
/
Copy pathcupboards.cpp
File metadata and controls
43 lines (42 loc) · 775 Bytes
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
#include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
int c1 = 0, c2 = 0;
int arr[n][2];
int result = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> arr[i][j];
}
for (int j = 0; j < 2; j++)
{
if (j == 0 && arr[i][j] == 0)
{
c1++;
}
else if (j == 1 && arr[i][j] == 0)
{
c2++;
}
}
}
if (c1 > (n - c1))
{
result = result + n - c1;
}
else
result = result + c1;
if (c2 > (n - c2))
{
result = result + n - c2;
}
else
result = result + c2;
cout << result;
return 0;
}