So, I posted this code (a bit messy because its after a few fixes) to round 2, and I got WA. according to the analysis, my idea is right, but I still got WA. Can anyone spot why, or should I try and ask for a second look from the codejam team? I tried many local tests and I couldn't find anything wrong
def main(): N = int(input()) holes = [] for i in range(N): a = [int(x) for x in input().split()] holes.append(tuple(a)) if N <= 4: return N slants = {} actual_lines = {} for cur_hole in holes: for j in holes: if j == cur_hole: continue if cur_hole[0] == j[0]: slant = 'inf' else: slant = float(cur_hole[1] - j[1]) / float(cur_hole[0] - j[0]) slants.setdefault(slant, [set(), 2]) slants[slant][0].add(cur_hole) slants[slant][0].add(j) if slant == 'inf': y = cur_hole[0] else: y = cur_hole[1] - slant * cur_hole[0] yy = (slant, y) #actual_lines.setdefault(yy, set([])) #actual_lines[yy].add(cur_hole) #actual_lines[yy].add(j) #for i in actual_lines: # if len(actual_lines[i]) % 2: # slants[i[0]][1] ^= 3 a = slants[max(slants, key=lambda x: len(slants[x][0]) + (len(slants[x][0])%2==0))] a = len(a[0]) + (len(a[0])%2==0) return min(N, max(a+1,4)) num_of_cases = [int(x) for x in input().split()][0] for p in range(num_of_cases): output = main() print("Case #{0}: {1}".format(p + 1, output)) -- 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 google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/32e648cf-03cc-48a7-aa8f-0408ba057827%40googlegroups.com.