Incredible Chess : Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, k = 1;
cin >> t;
while(t--)
{
int n;
cin >> n;
int a[n], b[n];
for(int i=0;i<n;i++)
cin >> a[i];
for(int i=0;i<n;i++)
cin >> b[i];
int xor_sum = 0;
for(int i=0;i<n;i++)
{
int difference = b[i] - a[i] - 1;
if(difference > 0)
xor_sum ^= difference;
}
if(xor_sum > 0)
cout << "Case " << k++ << ": white wins" << "\n";
else
cout << "Case " << k++ << ": black wins" << "\n";
}
return 0;
}
Comments
Post a Comment