1
I’m trying to pass a code on the SPOJ (http://br.spoj.com/problems/MITO09/) for solving a very simple problem: Read a matrix, read matrix coordinates, and check whether the same coordinate has been read twice. If yes, print 1. If not, print 0.
I am receiving error: error in Checkpoint time (NZEC).
The code:
import sys
import psyco
psyco.full()
def main():
matriz = [[]]
i = 0
j = 0
repetido = False
x = 0
y = 0
n = 0
#sys.stdin.readline()
for i in range(530):
for j in range(530):
matriz[i].append(0)
matriz.append([])
del matriz[530]
n = int(raw_input())
for i in range(n):
gamb = raw_input().split();
x = int(gamb[0])
y = int(gamb[1])
if matriz[x][y] == 1:
repetido = True
else:
matriz[x][y] = 1
if repetido:
print "1"
else:
print "0"
main()
What could cause this kind of mistake? Thank you!
Note that as you are inside a loop from the first that gives repeated all the others will be considered repeated, whether or not.
– user4552