PROBLEM LINK:
Author: harendrasingh
Tester: harendrasingh
Editorialist: harendrasingh
DIFFICULTY:
EASY-MEDIUM
PREREQUISITES:
Nim Game,Game Theory
PROBLEM:
The problem was just straightforward Nim’s Game.
QUICK EXPLANATION:
Just find the Nim Sum for each test case and print “Isa” for NimSum=0 else print “Gaitonde”.
EXPLANATION:
Just find the Nim Sum for each test case and print “Isa” for NimSum=0 else print “Gaitonde”.
The Nim Sum of a sequence of numbers is the bitwise XOR of each number in the sequence.
ALTERNATE EXPLANATION:
Comment down below if there is some alternative optimal solution anyone used.
SOLUTIONS:
Setter's Solution
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().strip().split()))
NimSum=0
for j in a:
NimSum^=j
if(NimSum==0):
print("Isa")
else:
print("Gaitonde")
Tester's Solution
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().strip().split()))
x=0
for j in a:
x^=j
if(x==0):
print("Isa")
else:
print("Gaitonde")