BULLETS -Editorial

PROBLEM LINK:

Practice
Contest

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")
1 Like

Further details, with links etc (forgive my copy-n-paste from another post :))

2 Likes

This is quite a nice editorial. Much better than the last one

2 Likes

Thanks @aryan12 for the appreciatation !