Problem p02761 (python)

Fixed submission:

N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,'1')
else:
    answer =['0']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))

Buggy submission (verdict: Runtime Error):

N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,'1')
else:
    answer =['0']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(''-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))

Buggy submission (verdict: Runtime Error):

N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,1)
else:
    answer =['1']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))

Buggy submission (verdict: Runtime Error):

N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,1)
else:
    answer ='1'
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))

Buggy submission (verdict: Runtime Error):

N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
answer.insert(0,1)
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))

Buggy submission (verdict: Runtime Error):

N,M = map(int, input().split())
answer = ['0']* (N-1)
answer.insert(0,1)
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))