Just attempted the GCJ 2020 : Round 1B. I was able to solve Blindfolded 
Bullseye but my code for Expogo gave wrong answer. Would have got a good 
score if I could have cracked this as well. 
Here's my python3 code.

T = int(input())
t = 1 
while(t <= T):
    res = ""
    Y = input().split(" ")
    X = int(Y[0])
    Y = int(Y[1])
    X1 = abs(X)
    Y1 = abs(Y)
    while(X1 > 4 or Y1 > 4):
        if((X1+Y1)%2 == 0):
            res = "IMPOSSIBLE"
            break
        else:
            if(X1 % 2 != 0):
                c1 = (X1+1)//2 + (Y1)//2
                c2 = (X1-1)//2 + (Y1)//2
                if(c1 % 2 == 0):
                    res += "E"
                    X1 = (X1-1)//2
                else:
                    res += "W"
                    X1 = (X1+1)//2
                Y1 //= 2
            elif(Y1 % 2 != 0):
                c1 = (Y1+1)//2 + (X1)//2
                c2 = (Y1-1)//2 + (X1)//2
                if(c1 % 2 == 0):
                    res += "S"
                    Y1 = (Y1-1)//2
                else:
                    res += "N"
                    Y1 = (Y1+1)//2
                X1 //= 2
            else: 
                break
    if(X1 == 0 and Y1 == 1):
        res += "S"
    elif(X1 == 1 and Y1 == 0):
        res += "E"
    elif(X1 == 0 and Y1 == 3):
        res += "SS"
    elif(X1 == 3 and Y1 == 0):
        res += "EE"
    elif(X1 == 1 and Y1 == 2):
        res += "ES"
    elif(X1 == 2 and Y1 == 1):
        res += "SE"
    elif(X1 == 2 and Y1 == 3):
        res += "SEN"
    elif(X1 == 3 and Y1 == 2):
        res += "ESW"
    elif(X1 == 1 and Y1 == 4):
        res += "WES"
    elif(X1 == 4 and Y1 == 1):
        res += "NSE"
    elif(X1 == 3 and Y1 == 4):
        res += "EES"
    elif(X1 == 4 and Y1 == 3):
        res += "SSE"
    else: 
        res = "IMPOSSIBLE"
    if(res != "IMPOSSIBLE"):
        l = list(res)
        if(X < 0):
            for i in range(len(l)):
                if(l[i] == "S"):
                    l[i] = 'N'
                elif(l[i] == 'N'):
                    l[i] = 'S'
        if(Y < 0):
            for i in range(len(l)):
                if(l[i] == "E"):
                    l[i] = 'W'
                elif(l[i] == 'W'):
                    l[i] = 'E'
        res = ''.join([str(elem) for elem in l])
    print("Case #{}: {}".format(t,res))
    t += 1

Would be great if someone could point out my mistake. 

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/7b622114-7c6a-437d-8960-528bad2508cd%40googlegroups.com.

Reply via email to