t = int(input())
for _ in range(0,t):
n = int(input())
elens=0
olens=0
zeros=0
ones=0
for i in range(0,n):
num1 = input()
if(len(num1)%2==0):
elens+=1
else:
olens+=1
for j in range(0,len(num1)):
if(num1[j]=="0"):
zeros+=1
else:
ones+=1
if(olens>0):
print(n)
else:
if(zeros%2==1 and ones%2==1):
print(n-1)
else:
print(n)
#include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin>>t;
while(t--)
{
long long n;
cin>>n;
vector<string>v(n);
for(long long i=0;i<n;i++)
{
cin>>v[i];
}
long long z=0,o=0,len=0;
for(long long i=0;i<n;i++)
{
for(long long j=0;j<v[i].size();j++)
{
if(v[i][j]=='0')
z++;
else
o++;
}
len+=(v[i].size()/2);
}
if((z/2)+(o/2)>=len)
{
cout<<n<<endl;
}
else
cout<<n-1<<endl;
}
}
1608B - Build the Permutation | 1505A - Is it rated - 2 |
169A - Chores | 765A - Neverending competitions |
1303A - Erasing Zeroes | 1005B - Delete from the Left |
94A - Restoring Password | 1529B - Sifid and Strange Subsequences |
1455C - Ping-pong | 1644C - Increase Subarray Sums |
1433A - Boring Apartments | 1428B - Belted Rooms |
519B - A and B and Compilation Errors | 1152B - Neko Performs Cat Furrier Transform |
1411A - In-game Chat | 119A - Epic Game |
703A - Mishka and Game | 1504C - Balance the Bits |
988A - Diverse Team | 1312B - Bogosort |
1616B - Mirror in the String | 1660C - Get an Even String |
489B - BerSU Ball | 977C - Less or Equal |
1505C - Fibonacci Words | 1660A - Vasya and Coins |
1660E - Matrix and Shifts | 1293B - JOE is on TV |
1584A - Mathematical Addition | 1660B - Vlad and Candies |