Hi, this is for the Round 1C that have just passed. I have been stuck on it for 4 hours. Hope that a kind soul will be able to guide me. I wrote it in python 3
URL: https://codingcompetitions.withgoogle.com/codejam/round/00000000000516b9/0000000000134c90 #all read functions credit to EricStansifer #Q1 def readline(): return input() def readint(): return int(input()) def readfloat(): return float(input()) def readints(): xs = input().split() return [int(x) for x in xs] def readfloats(): xs = input().split() return [float(x) for x in xs] def printcase(casenum, x): print('Case #{:d}: {}'.format(casenum, x)) def run(main): t = readint() for casenum in range(1, t + 1): main(casenum) def main(casenum): a = readint() #number of other robots ls = [] own_d = {'P':'R','R':'S','S':'P'} for i in range(a): ls.append(readline()) ans = '' for col in range(500): if len(ls)== 0: printcase(casenum, '{}'.format(ans)) return s = set() for things in ls: s.add(things[col%(len(things))]) if len(s) ==3: printcase(casenum, '{}'.format('IMPOSSIBLE')) return elif len(s) == 2: if 'R' in s and 'P' in s: move = 'p' elif 'R' in s and 'S' in s: move = 'R' elif 'P' in s and 'S' in s: move = 'S' else: if 'R' in s: move = 'P' elif 'P' in s: move = 'S' else: move = 'R' ans += move owned = own_d[move] ls = [q for q in ls if not q[col%(len(q))]== owned] ''' def todel(y): if "S" in y: return move == "R" if "R" in y: return move == "P" if "P" in y: return move == "S" ls = list(y for y in ls if not todel(y[col % len(y)])) ''' printcase(casenum, '{}'.format(ans)) return run(main) -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/c0734018-617a-47cf-bb1e-5d63f14f30b2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
