-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.cpp
More file actions
37 lines (37 loc) · 704 Bytes
/
1.cpp
File metadata and controls
37 lines (37 loc) · 704 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
#include <iostream>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int t;
cin >> t;
while (t--){
int n;
int a, cnt0 = 0, cnt1 = 0;
int b, m1;
cin >> n;
for(int i = 0; i < 2*n; i++){
cin >> a;
if (a == 0) {
cnt0 += 1;
}
else {
cnt1 += 1;
}
}
int m0;
if (cnt0 % 2 == 0){
m0 = 0;
}
else {
m0 = 1;
}
if (cnt1 > cnt0){
m1 = cnt0;
}
else {
m1 = cnt1;
}
cout << m0 << ' ' << m1 << '\n';
}
}