Skip to content

Instantly share code, notes, and snippets.

@kierendavies kierendavies/
Created Apr 15, 2013

What would you like to do?
Google Code Jam 2013 Qualification Round Problem B
from itertools import product
T = int(input())
for t in range(T):
N, M = list(map(int, input().split()))
grid = [list(map(int, input().split())) for n in range(N)]
rowmax = list(map(max, grid))
colmax = list(map(max, map(list, zip(*grid))))
for n, m in product(range(N), range(M)):
if grid[n][m] != rowmax[n] and grid[n][m] != colmax[m]:
print("Case #{}: NO".format(t + 1))
print("Case #{}: YES".format(t + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.