Matrix Game Solution
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int t, k = 1;
cin >> t;
while(t--)
{
int n, m;
cin >> n >> m;
ll v, xor_sum = 0;
for(int i=0; i<n; i++)
{
ll sum = 0;
for(int j=0; j<m; j++)
{
cin >> v;
sum += v;
}
xor_sum ^= sum;
}
if(xor_sum > 0)
cout << "Case " << k++ << ": Alice" << "\n";
else
cout << "Case " << k++ << ": Bob" << "\n";
}
return 0;
}
Comments
Post a Comment