Problem p02761 (python)

Fixed submission:
N,M = map(int,input().split())
sc=[list(map(int,input().split()))for _ in range(M)]
ans = -1
for i in range(1000):
  s = str(i)
  if len(s) == N:
    flg = 0
    for a,b in sc:
      if int(s[a-1]) != b:
        flg = 1
    if flg == 0:
      ans = i
      break
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
SC = [list(map(int, input().split())) for i in range(M)]
l = []
first = []
second = []
third = []
for s,c in SC:
  if s == 1:
    first.append(c)
  elif s == 2:
    second.append(c)
  elif s == 3:
    third.append(c)
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
SC = [list(map(int, input().split())) for i in range(M)]
l = []
first = []
second = []
third = []
for i in range(M):
  for s,c in SC:
    if s[i] == 1:
      first.append(c[i])
    elif s[i] == 2:
      second.append(c[i])
    elif s[i] == 3:
      third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
s,c = [map(int,input().split()) for i in range(M)]
l = []
first = []
second = []
third = []
for i in range(M):
  if s[i] == 1:
    first.append(c[i])
  elif s[i] == 2:
    second.append(c[i])
  elif s[i] == 3:
    third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
s,c = [map(int,input()) for i in range(M)]
l = []
first = []
second = []
third = []
for i in range(M):
  if s[i] == 1:
    first.append(c[i])
  elif s[i] == 2:
    second.append(c[i])
  elif s[i] == 3:
    third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
s = [int(input()) for i in range(M)]
c = [int(input()) for i in range(M)]
l = []
first = []
second = []
third = []
for i in range(M):
  if s[i] == 1:
    first.append(c[i])
  elif s[i] == 2:
    second.append(c[i])
  elif s[i] == 3:
    third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
s = [int(input()) for i in range(M)]
c = [int(input()) for i in range(M)]
first = []
second = []
third = []
for i in range(M):
  if s[i] == 1:
    first.append(c[i])
  elif s[i] == 2:
    second.append(c[i])
  elif s[i] == 3:
    third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)