problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02761
u054825571
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M=map(int,input().split())\np=True\nl=[-1 for _ in range(N)]\nfor i in range(M):\n s,c=map(int,input().split())\n if l[s-1] == -1:\n l[s-1] = c\n elif not l[s-1]==c:\n p=False\nif p:\n ans=""\n if l[0]==0:\n p=False\n elif l[0]==-1:\n if len(l)==1:\n ans="0"\n else:\n ans="1"\n else:...
['Wrong Answer', 'Accepted']
['s432660573', 's758406918']
[9232.0, 9240.0]
[30.0, 26.0]
[433, 467]
p02761
u054931633
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import sys\ndef get_unique_list(seq):\n seen = []\n return [x for x in seq if x not in seen and not seen.append(x)]\n\nn,m = map(int,input().split())\nl = [list(map(int,input().split())) for _ in range(m)]\nd = {}\nfor i in l:\n if i[0] in d and d[i[0]] != i[0]:\n d[i[0]] += 1\n print("-1")\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s492503283', 's766170477', 's014665672']
[3064.0, 2940.0, 3064.0]
[18.0, 17.0, 18.0]
[864, 953, 968]
p02761
u057079894
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['#n = int(input())\n#s = input()\n#n, k= map(int,input().split())\n#da = list(map(int,input().split()))\n\nn,m = map(int,input().split())\nda = [list(map(int,input().split())) for i in range(m)]\n\nans = -1\nfor i in range(10**(n)):\n now = str(i)\n ju = True\n for j in range(m):\n if len(now) < da[j][...
['Wrong Answer', 'Accepted']
['s942761555', 's607870008']
[3064.0, 3188.0]
[20.0, 18.0]
[492, 546]
p02761
u057668615
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = list(map(int, input().split()))\nins = True\nans = [0]*N\nok = True\nfor i in range(M):\n s, c = list(map(int, input().split()))\n if s==1 and c==0:\n ok = False\n if ans[s-1]==0 or ans[s-1]==c:\n ans[s-1] = c\n else:\n ok = False\n if s == 1:\n ins = True\n else:\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s464111169', 's680990208', 's124573227']
[3192.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[523, 547, 625]
p02761
u057993957
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = list(map(int, input().split()))\nsc = [list(map(int,input().split())) for i in range(m)]\n\nfor i in range(0, 10**n):\n str_i = str(i)\n if len(str_i) != n: continue\n\n chk = True\n for s, c in sc:\n cnt &= str_i[s-1] == str(c)\n if chk:\n print(i)\n exit()\n\n print(-1)\n ', 'n, m = list(m...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s047653033', 's850282901', 's172064053']
[3060.0, 3188.0, 3060.0]
[18.0, 19.0, 18.0]
[286, 320, 292]
p02761
u060432908
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nnum=[0 for i in range(n)]\nflag=[False for i in range(n)]\ns=[]\nc=[]\nfor i in range(m):\n si,ci=map(int,input().split())\n s.append(si)\n c.append(ci)\n\ndef ans():\n for i in range(m):\n if s[i]-1==0 and c[i]==0:\n continue\n if !flag[s[i]-1]:\n ...
['Runtime Error', 'Accepted']
['s968537020', 's841649350']
[2940.0, 3064.0]
[17.0, 18.0]
[541, 498]
p02761
u060694763
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["import sys\nN, M = list(map(int, input().split()))\n\nnumlist = ['-'] * N\nfor m in range(M):\n s, c = list(map(int, input().split()))\n if numlist[s - 1] == '-':\n numlist[s - 1] = c\n else:\n if numlist[s - 1] == c:\n print(-1)\n sys.exit(0)\n\n\nif numlist[0] == '-' or ...
['Wrong Answer', 'Accepted']
['s850212775', 's441476941']
[3064.0, 3064.0]
[23.0, 17.0]
[548, 584]
p02761
u064571674
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["from collections import Counter\n\nn,m = map(int,input().split())\nl1 = []\n\nfor i in range(m):\n l1.append(list(map(int,input().split())))\n\nl1 = list(set(list(map(tuple, l1))))\n\nans = ''\nfor i in range(len(l1)):\n for j in range(len(l1)):\n if i < j:\n if l1[i][0] == l1[j][0]:\n ...
['Wrong Answer', 'Accepted']
['s293233466', 's322718566']
[3316.0, 3444.0]
[21.0, 25.0]
[689, 784]
p02761
u067694718
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = [int(i) for i in input().split()]\nsc = [[int(i) for i in input().split()] for j in range(m)]\n\nfor i in range(900):\n result = True\n num = str(100 + i)\n for j in range(m):\n s, c = sc[j]\n if not num[s - 1] == c:\n result = False\n break\n if(result):\n ...
['Wrong Answer', 'Accepted']
['s993404021', 's184695775']
[3060.0, 3064.0]
[18.0, 18.0]
[349, 384]
p02761
u074372598
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["def main():\n N, M = map(int, input().split())\n d = {}\n for _ in range(M):\n s, c = map(int, input().split())\n if s == 1 and c==0:\n print('-1')\n return\n if s in d and d[s] != c:\n print('-1')\n return\n if s > N:\n print...
['Wrong Answer', 'Accepted']
['s680401749', 's142796438']
[3064.0, 3064.0]
[17.0, 17.0]
[689, 707]
p02761
u075303794
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N,M=map(int,input().split())\nans=['0']*N\nI=[]\nfor _ in range(M):\n s,c=input().split()\n index=int(s)-1\n if index==0 and N!=1 and c=='0':\n print(-1)\n break\n if index in I and ans[index]!=c:\n print(-1)\n break\n ans[index]=c\n I.append(index)\n \n ", "N,M=map(int,input().split())\nans=['0']...
['Wrong Answer', 'Accepted']
['s082170972', 's315169776']
[9176.0, 9124.0]
[33.0, 28.0]
[260, 321]
p02761
u079022693
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['from sys import stdin\ndef main():\n \n readline=stdin.readline\n N,M=map(int,readline().split())\n s=[0]*M\n c=[0]*M\n for i in range(M):\n a,b=map(int,readline().split())\n s[i]=a\n c[i]=b\n\n for n in range(10**N):\n n=str(n)\n for i in range(M):\n ...
['Wrong Answer', 'Accepted']
['s161837916', 's972420603']
[3064.0, 3064.0]
[18.0, 19.0]
[523, 517]
p02761
u081445185
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['def int_values(slr):\n l, r = map(lambda s: int(s), slr)\n return l, r\n\n\ndef conv_digits(N, digits):\n for i in range(N):\n if digits[i] is None:\n digits[i] = \'0\' if i == 0 and N == 1 else \'1\'\n\n return \'\'.join(digits)\n\n\ndef main():\n N, M = int_values(input().split())\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s827412559', 's831803753', 's448960946']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[732, 712, 740]
p02761
u089925107
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["import sys\nN,M = map(int,input().split())\ncc = [list(map(int, input().split())) for i in range(M)]\nif [0,1] in cc:\n if N!= 1:\n print(-1)\n sys.exit()\na,b = [0]*N,['v']*N\nfor [i,j] in cc:\n a[i-1] = j\n if b[i-1] != 'v' or b[i-1] != j:\n print(-1)\n sys.exit\n b[i-1] = j\nif a[0] = 0:\n a[0] = ...
['Runtime Error', 'Accepted']
['s624912932', 's877000692']
[8936.0, 9132.0]
[26.0, 29.0]
[360, 368]
p02761
u091307273
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["def main():\n n, m = list(map(int, input().split()))\n dcon = [set() for _ in range(n)]\n for _ in range(m):\n s, c = tuple(map(int, input().split()))\n dcon[s-1].add(c)\n\n if any(len(d) > 1 for d in dcon):\n print(-1)\n return\n \n digits = [0] if n == 1 else [1] + [0] ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s023006108', 's390456239', 's894367261']
[9040.0, 9080.0, 9200.0]
[26.0, 25.0, 32.0]
[430, 627, 509]
p02761
u093783313
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\n \nm = []\nfor i in range(M):\n m.append(list(map(int,input().split())))\nfor i in range(10**N):\n a = str(i)\n \n if i >= 10**(N-1):\n \n for j in range(M):\n try:\n \n if a[m[j][0]-1] == str(m[j][1]):\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s033031460', 's169385806', 's174946753']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 19.0]
[718, 734, 728]
p02761
u094425865
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["import sys\n\nn,m = map(int,input().split())\nif m == 0:\n print('-1')\n sys.exit()\na = []\nwk =[]\nkai = 0\nfor i in range(m):\n wk = (list(map(int,input().split())))\n if wk in a:\n m -= 1\n else:\n a.append(wk)\n\na.sort()\n\nif a[m-1][0] != 1 or a[m-1][1] == 0:\n print('-1')\n...
['Wrong Answer', 'Accepted']
['s356653728', 's441351134']
[3064.0, 3192.0]
[17.0, 18.0]
[566, 865]
p02761
u095094246
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import sys\nn,m=map(int,input().split())\nsc = [list(map(int,input().split())) for i in range(m)]\nfor i in range(10**n):\n for j in range(m):\n sti = str(i)\n if sti[sc[j][0]-1] != str(sc[j][1]):\n break\n else:\n print(i)\n sys.exit()\nprint(-1)', 'import sys\nn,m=map(int,input().split())\nsc = [...
['Runtime Error', 'Accepted']
['s281465724', 's748046095']
[3064.0, 3064.0]
[17.0, 18.0]
[255, 290]
p02761
u098968285
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = list(map(int, input().split()))\nans = [-1]*N\n\nflag = True\nfor _ in range(M):\n s, c = list(map(int, input().split()))\n if s == 1 and c == 0:\n flag = False\n break\n \n if ans[s-1] == -1:\n ans[s-1] = c\n else:\n if ans[s-1] != c:\n flag = False\n ...
['Wrong Answer', 'Accepted']
['s861527437', 's648907445']
[3064.0, 3064.0]
[17.0, 18.0]
[408, 803]
p02761
u102126195
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\n\ncheck = [0 for i in range(n)]\nans = [0 for i in range(n)]\nfor i in range(m):\n s, c = map(int, input().split())\n if check[s - 1] and check[s - 1] != c:\n ans[0] = -1\n break\n check[s - 1] = c\n ans[s - 1] = c\n\nif ans[0] == -1 or ans[0] == 0:\n pri...
['Wrong Answer', 'Accepted']
['s216870911', 's816531614']
[3064.0, 3064.0]
[17.0, 18.0]
[373, 540]
p02761
u102223485
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\n# print("N:", N, "M:", M)\ns = [list(map(int, input().split())) for _ in range(M)]\ns.sort()\n# print(s)\n\nc = []\nfor i in range(N):\n c.append(0)\n\nfor i in s:\n print("i:", i)\n if i[0] - 1 == 0 and i[1] == 0:\n pass\n elif (c[i[0] - 1] == 0) or (c[i[0] - 1] >...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s294039366', 's504042902', 's696289377', 's698758547', 's866434322', 's867367505', 's458694708']
[3064.0, 3064.0, 3188.0, 3064.0, 3192.0, 3064.0, 3064.0]
[17.0, 17.0, 19.0, 17.0, 17.0, 17.0, 17.0]
[438, 390, 532, 398, 381, 520, 522]
p02761
u103520789
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\ns_c = []\nfor _ in range(M):\n s_c.append(list(map(int, input().split())))\n \n \nflag = False\nnum = [-1,-1,-1]\nfor s,c in s_c:\n if num[s-1] == -1:\n num[s-1] = c\n elif not num[s-1] == c:\n flag = True\n\n# print(num)\nans = 0\nif flag:\n print(-1)\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s193685448', 's257329268', 's440977661', 's654534917', 's837310795', 's925800112', 's985736648', 's686885012']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0, 3064.0, 3188.0]
[18.0, 17.0, 17.0, 17.0, 19.0, 19.0, 18.0, 19.0]
[457, 652, 680, 473, 453, 484, 480, 486]
p02761
u103902792
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m = map(int,input().split())\nd = {}\nfor _ in range(m):\n s,c = map(int,input().split())\n if s > n:\n print(-1)\n exit()\n if s in d:\n if d[s] == c:\n continue\n else:\n print(-1)\n exit()\n else:\n d[s] = c\n\nans = ''\nfor i in range(n):\n if i+1 in d:\n ans += str(d[i+1])...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s356025230', 's500686599', 's802713410', 's931253695']
[3188.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 17.0]
[335, 465, 296, 496]
p02761
u104005543
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().split())\na = [-1 for i in range(n)]\npossibility = True\nfor i in range(m):\n s, c = map(int, input().split())\n if a[s - 1] == -1:\n a[s - 1] = c\n elif a[s - 1] == c:\n pass\n else:\n possibility = False\nif a[0] == 0:\n possibility = False\n\nif possibil...
['Runtime Error', 'Accepted']
['s173344832', 's454236705']
[3064.0, 3064.0]
[17.0, 17.0]
[409, 407]
p02761
u106342872
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().split())\n\ns = [0] * m\nc = [0] * m\n\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n\nans = False\nfor x in range(10 ** (n - 1), 10 ** n):\n x = list(str(x))\n flag = True\n for i in range(m):\n if int(x[s[i]-1]) == c[i]:\n pass\n else:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s219351459', 's391749131', 's685526186', 's946840350']
[3064.0, 3064.0, 3064.0, 3188.0]
[17.0, 17.0, 17.0, 20.0]
[680, 684, 683, 694]
p02761
u109396127
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N = int(input())\nM = int(input())\n\nfrag = True\nfor i in range(N):\n A[i] = -1\nfor i in range(M):\n si = int(input())\n ci = int(input())\n if A[si] != -1 and A[si] != ci:\n frag = False\n break\n else if si == 1 and ci == 0:\n frag = False\n break\n else:\n A[...
['Runtime Error', 'Accepted']
['s229600473', 's639703441']
[2940.0, 21264.0]
[17.0, 697.0]
[459, 559]
p02761
u109617108
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M=map(int,input().split())\nA=[-1]*N\nQ=True\nL=list(list(map(int,input().split())) for j in range(M))\nfor i in range(M):\n if A[L[i][0]-1]==-1 or A[L[i][0]-1]==L[i][1]:\n A[L[i][0]-1]==L[i][1]\n else:\n Q=False\nfor k in range(N):\n if A[k]==-1:\n if N!=1 and k==0:\n A[k]=1\n else:\n A[k]...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s075378469', 's434027042', 's618668055', 's860839664', 's865570639', 's948559758', 's977105744', 's465610983']
[3064.0, 3064.0, 2940.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0]
[423, 426, 412, 443, 434, 402, 425, 501]
p02761
u110199424
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\n\nsc = [list(map(int, input().split())) for _ in range(M)]\n\nans = [set() for _ in range(N)]\n\nfor i in range(M):\n ans[sc[i][0] - 1].add(sc[i][1])\n\n\n#print(ans)\n\nans_2 = ''\nfor i in range(N):\n if len(ans[i]) > 1 or (0 in ans[0]):\n ans_2 = -1\n break\n ...
['Wrong Answer', 'Accepted']
['s763060520', 's238043172']
[3064.0, 3064.0]
[17.0, 17.0]
[504, 529]
p02761
u111473084
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split(" "))\n\ndigit = [[] for i in range(3)]\nfor i in range(M):\n si, ci = map(int, input().split(" "))\n if si > N:\n print(-1)\n exit()\n digit[si-1].append(ci)\n\nfor i in range(N):\n if len(digit[i]) > 1:\n print(-1)\n exit()\n\nans = 0\ncoef = 10 ...
['Wrong Answer', 'Accepted']
['s685200908', 's273445978']
[3064.0, 3064.0]
[17.0, 18.0]
[495, 634]
p02761
u113255362
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M=map(int,input().split())\nflag = True\nres = ""\nList = []\nfor i in range (M):\n List.append(list(map(int, input().split())))\nresList = ["10"]*N\nfor i in range(M):\n if resList[List[i][0]-1] == "10":\n resList[List[i][0]-1] = str(List[i][1])\n else:\n if resList[List[i][0]-1] != str(List[i][1]):\n ...
['Wrong Answer', 'Accepted']
['s866734647', 's844299800']
[9236.0, 9260.0]
[28.0, 24.0]
[499, 678]
p02761
u115877451
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["a,b=map(int,input().split())\nc=[]\nfor _ in range(b):\n c.append(list(map(int,input().split())))\n\nfor i in range(b):\n for j in range(i):\n if c[i][0]==c[j][0] and c[i][1]!=c[j][1]:\n print(-1)\n exit()\nfor i in range(b):\n if c[i][1]==0:\n print(-1)\n exit()\n\...
['Wrong Answer', 'Accepted']
['s755798494', 's196350004']
[9076.0, 9172.0]
[30.0, 29.0]
[472, 526]
p02761
u116038906
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['from collections import defaultdict\nN,M = (int(x) for x in input().split())\nketa_num_str = [ (input().split()) for i in range(M) ]\n\n\nsuuji = ""\nnum_str_dic = defaultdict(set)\nkotae_dic ={ str(i):"0" for i in range(1,N + 1) } \nfor i in keta_num_str: \n num_str_dic[i[0]].add(i[1])\n\n\nfor i,v in num_str_d...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s373676138', 's424907157', 's520167098', 's747676166', 's637310294']
[3436.0, 3444.0, 3316.0, 3064.0, 3316.0]
[22.0, 23.0, 22.0, 18.0, 21.0]
[1107, 1106, 1105, 600, 1347]
p02761
u117793693
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = input().split(" ")\nN = int(N)\nM = int(M)\ns_list = []\nc_list = []\nfor i in range(M):\n si, ci = input().split(" ")\n s_list.append(int(si))\n c_list.append(int(ci))\n\nnum = ["0" for i in range(N)]\nis_num = [0 for i in range(N)]\nis_break = False\nfor si, ci in zip(s_list, c_list):\n if num[si...
['Runtime Error', 'Runtime Error', 'Accepted']
['s015798227', 's387269569', 's622627070']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 19.0]
[619, 601, 653]
p02761
u118760114
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\nsc = [list(map(int, input().split())) for i in range(m)]\nfor i in range(0, 10**n):\n if len(str(i)) == n and all(str(i)[s-1] == str(c) for j in sc):\n print(i)\n break\nelse:\n print(-1)', 'n, m = map(int, input().split())\nsc = [list(map(int, input().split())) f...
['Runtime Error', 'Accepted']
['s423909613', 's918871255']
[3060.0, 3064.0]
[18.0, 19.0]
[234, 236]
p02761
u121698457
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\nd = dict()\nfor o in range(1,N+1):\n d[o] = 1\nS = []\nC = []\nfor i in range(M):\n s, c = map(int,input().split())\n S.append(s)\n C.append(c)\n d[s] = c\nif (1, 0) in d.items():\n print(-1)\n exit()\nfor j in range(0,M-1):\n for k in range(j+1, M):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s171135232', 's526880315', 's944110566', 's286814968']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[444, 455, 381, 509]
p02761
u123849536
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['# -*- coding: utf-8 -*-\n# 157c\nn, m = map(int, input().split())\ns = []\nc = []\nfor _ in range(m):\n _s, _c = input().split()\n s.append(int(_s))\n c.append(_c)\n\nret = -1\nfor i in range(10 ** 4):\n for _s, _c in zip(s, c):\n if len(str(i)) < _s or str(i)[_s - 1] != _c:\n ret = -1\n break\n r...
['Wrong Answer', 'Accepted']
['s177450637', 's315576579']
[3064.0, 3064.0]
[28.0, 18.0]
[374, 390]
p02761
u127499732
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nif m==0 and n==1:\n print(0)\n exit()\nelse:\n print("1"+"0"*(n-1))\n exit()\n \nx=["0" for _ in range(n)]\nfor _ in range(m):\n s,c=map(int,input().split())\n if x[s-1] != \'0\' and x[s-1] != str(c):\n print(-1)\n break\n else:\n x[s-1] = str(c)\nelse:\n if n==1:\n ...
['Wrong Answer', 'Accepted']
['s606687147', 's866626308']
[3188.0, 3064.0]
[18.0, 17.0]
[371, 351]
p02761
u128661070
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['# -*- coding:utf-8 -*-\nn, m = map(int, input().strip().split())\nans = 0\nf_one = False\nfor i in range(m):\n tmp_d, tmp = map(int, input().strip().split())\n if tmp_d == 1:\n f_one = True\n \n if ((tmp_d == 1) and (tmp == 0)):\n ans = -1\n break\n elif (tmp_d in digit.keys()) and...
['Runtime Error', 'Accepted']
['s735371009', 's096815038']
[3064.0, 3064.0]
[17.0, 17.0]
[462, 482]
p02761
u130900604
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['\n# from collections import Counter\n\n# n=int(input())\n# s=input()\nn,m=map(int,input().split())\ncl=[-1]*n\nfor i in range(m):\n s,c=map(int,input().split())\n if cl[s-1]==-1 or cl[s-1]==c:\n cl[s-1]=c\n else:\n print(-1)\n exit()\nif cl[0]==0:\n print(-1)\n exit()\nif cl[0]==-1...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s286140674', 's690429441', 's906460483']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[530, 504, 239]
p02761
u131638468
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M=map(int,input().split())\nn=int(N)\nm=int(M)\nnumlist=[0,0,0]\naccess_log=[0,0,0]\nanswer=0\nfor i in range(m):\n s,c=map(int,input().split())\n s=int(s)\n c=int(c)\n if access_log[s]==1 and numlist[s]!=c:\n answer=-1\n break\n else:\n numlist[s]=c\n access_log[s]=1\nif answer==-1:\n print(answe...
['Runtime Error', 'Accepted']
['s274060486', 's583544541']
[3064.0, 3064.0]
[18.0, 18.0]
[416, 560]
p02761
u131944095
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import sys\nn, m = map(int, input().split())\nS,C=[],[]\n\nfor _ in range(m):\n s,c=map(int,input().split())\n S.append(s)\n C.append(c)\ncur = 0\nfor i in range(10**(n-1)-1, 10**n):\n isOk = True\n for j in range(m):\n if str(i)[S[j]-1] != str(C[j]):\n isOk = False\n if isOk:\n print(i)\n sys.exi...
['Runtime Error', 'Accepted']
['s213202519', 's038277417']
[3064.0, 3060.0]
[19.0, 18.0]
[315, 340]
p02761
u132878037
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=(int(x) for x in input().split())\nk=m+1\ns=[0]*k\nc=[0]*k\nanswer=0\nfor i in range(m):\n s[i+1],c[i+1]=(int(x) for x in input().split())\n\n\na=[-1]*10\n\nfor i in range(m):\n if a[s[i+1]]==-1:\n a[s[i+1]]=c[i+1]\n elif not a[s[i+1]]==c[i+1]:\n answer=-1\nif a[1]==0 and not n=1:\n answ...
['Runtime Error', 'Accepted']
['s457192659', 's480617612']
[3064.0, 3188.0]
[17.0, 19.0]
[524, 527]
p02761
u133347536
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['op = [list(map(int, inp.split())) for inp in open(0)]\nprint(op)\nn = op[0][0]\nm = op[0][1]\ns = []\nc = []\ndict_ = {}\nflag = True\nfor i in range(1, m + 1):\n s = n + 1 - op[i][0]\n c = op[i][1]\n if s in dict_:\n if dict_[s] == c:\n pass\n else:\n flag = False\n else:\n dict_[s] = c\n if ...
['Wrong Answer', 'Accepted']
['s192969408', 's832164825']
[3064.0, 3064.0]
[17.0, 20.0]
[529, 652]
p02761
u136843617
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['#C - Guess The Number https://atcoder.jp/contests/abc157/tasks/abc157_c\nx,m = map(int, input().split())\ns=[-1]*m\nc=[-1]*m\nnum = [-1]*3\nans = 0\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n\nfor j, l in zip(s, c):\n if num[j-1] == -1:\n num[j-1] = l\n elif num[j-1] != l:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s178623679', 's600775919', 's859720915', 's390446213']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 18.0]
[566, 550, 561, 381]
p02761
u137226361
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().split())\nans = ['t'] * n\n\nfor _ in range(m):\n s, c = map(int, input().split())\n if ans[s-1] =='t' or ans[s-1] == str(c):\n ans[s-1]= str(c)\n else:\n print(-1)\n exit(0)\nans = ''.join(ans).replace('t', str(0))\nprint(ans)\nans = int(ans)\nl = str(ans)\nprint...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s370405918', 's743496689', 's061681664']
[9220.0, 9200.0, 9220.0]
[27.0, 24.0, 28.0]
[358, 338, 384]
p02761
u139112865
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m=map(int,input().split())\nd={i:-1 for i in range(1,n+1)}\nflg=True\nfor _ in range(m):\n s,c=map(int,input().split())\n if s==1 and c==0:\n flg=False\n elif d[s]==-1:\n d[s]=c\n else:\n flg=False\n\nans=[]\nfor i in range(1,n+1):\n if d[i]==-1:\n if i==1:\n d[...
['Wrong Answer', 'Accepted']
['s213230171', 's402389864']
[3064.0, 3064.0]
[17.0, 18.0]
[416, 507]
p02761
u143051858
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int, input().split())\ns1 = []\ns2 = []\nflg = True\nfor i in range(M):\n n1,n2 = map(int,input().split())\n s1.append(n1)\n s2.append(n2)\nfor i in range(1000):\n flg = True\n num = [int(x) for x in list(str(i))]\n if len(num) == N:\n for j in range(M):\n if s2[j] != num[s1[j] - 1]:\n ...
['Wrong Answer', 'Accepted']
['s037215304', 's754934656']
[3064.0, 3064.0]
[19.0, 20.0]
[417, 365]
p02761
u143212659
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\ndef main():\n N, M = map(int, input().split())\n result = [0] * N\n\n for m in range(M):\n s, c = map(int, input().split())\n if s == 1 and c == 0:\n print(-1)\n exit(0)\n\n if result[s - 1] == c:\n con...
['Wrong Answer', 'Accepted']
['s672931062', 's813341547']
[3064.0, 3060.0]
[17.0, 18.0]
[626, 417]
p02761
u145600939
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\narray = [10]*N\nT_F = True\n\nfor i in range(M):\n s,c = map(int,input().split())\n if s>N or (array[s-1] != 10 and array[s-1] !=c) or (s == 1 and c == 0):\n T_F = False\n break\n else:\n array[s-1] = c\nans = 0\n\nif T_F:\n for i in range(N):\n if array[i] == 10:\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s057999995', 's234611038', 's112380278']
[2940.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[428, 434, 454]
p02761
u150641538
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["f = True\nn,m=map(int,input().split())\nnumber = [-1 for i in range(n)]\nfor i in range(m):\n s,c=list(map(int,input().split()))\n s -= 1\n if s == 0 and c == 0 and n > 1:\n f = False\n elif number[s] == -1:\n number[s] = c\n f = False\n else:\n f = False\nif not f:\n print(-1)\nelif n == 1:\n if n...
['Wrong Answer', 'Accepted']
['s735923984', 's574200048']
[3064.0, 3064.0]
[17.0, 17.0]
[506, 510]
p02761
u153902122
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M=map(int,input().split())\nres=[0]*(N)\nans=[0]*(N)\nfor i in range(M):\n si,ci=map(int,input().split())\n si-=1\n if res[si]==1 and ans[si]!=ci:\n print(-1)\n exit()\n res[si]=1\n ans[si]=ci\nif N==1:\n if ans==[0]:\n print(0)\n exit()\n else:\n print(ans[0]...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s573642238', 's742142492', 's905918036', 's972619138', 's929903894']
[3064.0, 3064.0, 3064.0, 3188.0, 3188.0]
[17.0, 17.0, 17.0, 19.0, 19.0]
[406, 412, 306, 403, 415]
p02761
u153968927
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = input().split()\nN = int(N)\nM = int(M)\nS = []\nC = []\nA = []\nzero_flag = False\nfor m in range(M):\n s, c = input().split()\n s = int(s)\n c = int(c)\n S.append(s)\n C.append(c)\n if s == 2 and c == 0 and N == 2:\n A.append('0')\n elif s == 2 and c == 0 and N == 3:\n A.append('00')\n elif s =...
['Wrong Answer', 'Accepted']
['s503703862', 's502109614']
[3064.0, 3064.0]
[17.0, 18.0]
[791, 793]
p02761
u155659281
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["import numpy as np\t\nimport sys\nstdin = open(0)\nN,M = (stdin.readline()).split()\nN = int(N)\nM = int(M)\nsc = []\nans = np.array([-1,-1,-1])\nfor i in range(M):\n sc.append(stdin.readline().split())\nsc = np.array(sc, dtype='int')\n\n\nif (N<1)|(N>3):\n print(-1)\n sys.exit()\nif (M<0)|(M>5):\n print(-1)\n s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s407045173', 's828111819', 's836842716']
[12504.0, 12504.0, 12504.0]
[151.0, 152.0, 150.0]
[1185, 1119, 1174]
p02761
u157020659
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().split())\ns_li = [list(map(int, input().split())) for i in range(m)]\n\nif n != 1:\n ans = ['1']\n ans.extend(['0'] * (n - 1))\nelse:\n ans = ['0']\n flag = [0] * n\n\nfor s, c in s_li:\n if flag[s - 1] == 0:\n ans[s - 1] = '{}'.format(c)\n flag[s - 1] = 1\n eli...
['Runtime Error', 'Accepted']
['s538424694', 's951449733']
[3064.0, 3064.0]
[17.0, 17.0]
[504, 500]
p02761
u157232135
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['def main():\n n, m = list(map(int, input().split()))\n r = [-1] * n\n for _ in range(m):\n i, v = map(int, input().split())\n if r[i-1] == -1:\n r[i-1] = v\n elif r[i-1] != v:\n print(-1)\n return\n r = [0 if i == -1 else i for i in r]\n r = "".join...
['Wrong Answer', 'Accepted']
['s393465075', 's230374138']
[3064.0, 3064.0]
[18.0, 18.0]
[434, 422]
p02761
u163501259
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\nsc = [list(map(int, input().split())) for i in range(m)]\n\nseen = []\nlist_1 = [ x for x in sc if x not in seen and not seen.append(x)]\n\nflag = [0]*n\nans = [0]*n\n\nfor i in range(len(list_1)):\n ans[list_1[i][0] - 1] = list_1[i][1]\n flag[list_1[i][0] - 1] += 1\n', "n, m...
['Wrong Answer', 'Accepted']
['s492757011', 's697737462']
[3064.0, 3064.0]
[19.0, 17.0]
[298, 587]
p02761
u163829702
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\nans = [-1]*N\nfor i in range(M):\n s, c = map(int, input().split())\n if ans[s-1] == -1:\n ans[s-1] = c\n elif ans[s-1] != c:\n print(-1)\n break\n\nprint(ans)\nif len(ans) == 1:\n print(0)\nelse:\n if ans[0] == 0:\n ans = [-1]\n elif ans...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s005502866', 's482160004', 's740074569', 's695089048']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0, 20.0]
[440, 386, 447, 513]
p02761
u164029270
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = [int(i) for i in input().rstrip().split()]\nn = 1 if N > 1 else 0\nC = [list(range(n,10))] + [list(range(10)) for i in range(N-1)]\n\nfor m in range(M):\n s,c = [int(i) for i in input().rstrip().split()]\n s -= 1\n if c in C[s]:\n C[s] = [c]\n else:\n print(-1)\n exit()\n pri...
['Wrong Answer', 'Accepted']
['s911951967', 's257461133']
[3064.0, 3064.0]
[17.0, 18.0]
[359, 360]
p02761
u167205647
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int,input().split())\nl = []\nfor i in range(m):\n l.append(list(map(int,input().split())))\nans = -1\nif n == 1:\n for i in range(10):\n i = str(i)\n flag = True\n for j in range(m):\n if i[l[j][0]-1] != str(l[j][1]) :\n flag = False\n if flag:\n ...
['Runtime Error', 'Accepted']
['s446747356', 's031386869']
[3064.0, 3064.0]
[18.0, 19.0]
[570, 601]
p02761
u167681750
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\n\nif n == 1 and m == 0:\n print(0)\n exit()\n\nans = [-1] * n\n\n\nfor i in range(m):\n s, c = map(int, input().split())\n s -= 1\n if ans[s] != -1 and ans[s] != c:\n print(-1)\n exit()\n\n else:\n ans[s] = c\n \nelif ans[0] == 0 and n >= 2:\...
['Runtime Error', 'Accepted']
['s651563604', 's142506401']
[2940.0, 3064.0]
[17.0, 17.0]
[430, 415]
p02761
u167908302
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["#coding:utf-8\nn, m = map(int, input().split())\nnum = '0' * n\ncount = [0, 0, 0]\n\n\nfor i in range(m):\n s, c = map(int, input().split())\n print(num, count)\n if (s == 1 and c == 0) or (count[s-1] >= 1 and int(num[s-1]) != c):\n print(-1)\n exit()\n else:\n count[s-1] += 1\n ...
['Wrong Answer', 'Accepted']
['s184351031', 's634458678']
[3064.0, 3064.0]
[18.0, 17.0]
[537, 520]
p02761
u167988719
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\nSC = [list(map(int, input().split())) for _ in range(M)]\n\nA = [-1] * N\nok= True\nfor s, c in SC:\n i = s-1\n if A[i] != -1 and A[i] != c:\n ok = False\n break\n A[i] = c\nif N > 1 and A[0]==0:\n ok = False\nif ok:\n for i in range(N):\n if A[i] ...
['Runtime Error', 'Accepted']
['s208149370', 's849437425']
[3064.0, 3064.0]
[17.0, 17.0]
[473, 474]
p02761
u169350228
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int,input().split())\n\nfor i in range(n):\n ans += "x"\n\npf = True\nfor i in range(m):\n s,c = map(int,input().split())\n if (not ans[s] == "x") and (not ans[s] == str(c)):\n print(-1)\n pf = False\n break\n else:\n ans[s] = str(c)\n\nif pf:\n if ans[0] == "x":\...
['Runtime Error', 'Accepted']
['s730716272', 's166946339']
[3064.0, 3064.0]
[17.0, 17.0]
[408, 545]
p02761
u169501420
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["# -*- coding: utf-8 -*-\nimport sys\n\n[N, M] = [int(i) for i in input().split()]\n\nSC = []\nfor m in range(M):\n [s, c] = [int(i) for i in input().split()]\n SC.append((s, c))\n\nans_str = ['0'] * N\n\nprint(ans_str)\n\nfor (s, c) in SC:\n if ans_str[s - 1] != '0' and ans_str[s - 1] != str(c):\n pri...
['Wrong Answer', 'Accepted']
['s137589393', 's059697501']
[3064.0, 3064.0]
[17.0, 17.0]
[611, 706]
p02761
u170410075
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m = map(int, input().split())\nsc=[list(map(int,input().split())) for i in range(m)]\ns=[]\nc=[]\nf=0\nans=[str(0) for i in range(n)]\nfor i in range(m):\n if sc[i][0]==1 and sc[i][1]==0 and n!=1:\n f=-1\n break\n else:\n if sc[i][0] in s:\n if sc[i][1]!=c[s.index(sc[i][0])]:\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s216976507', 's466499461', 's467751728', 's742929130', 's923564864', 's433084434']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 20.0]
[770, 673, 690, 713, 726, 1394]
p02761
u175034939
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int,input().split())\na = [-1]*n\nfor i in range(m):\n s, c = map(int,input().split())\n if a[s-1] >= 0:\n if a[s-1] != c:\n print(-1)\n exit()\n else:\n a[s-1] = c\n print(a)\n\nans = ''\nfor t in a:\n if t:\n ans += str(t)\n else:\n ...
['Wrong Answer', 'Accepted']
['s761276490', 's824529477']
[3064.0, 3064.0]
[17.0, 18.0]
[419, 552]
p02761
u175590965
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int,input().split())\na = [list(map(int,input().split()))for i in range(m)]\n\nfor i in range(10**n):\n tmp = str(i)\n if len(tmp) == n:\n f = True\n for s,c in a:\n if tmp[s-1] != str(c):\n f = False\n break\n if f :\n p...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s166729879', 's480991101', 's243431351']
[3060.0, 9120.0, 9080.0]
[18.0, 32.0, 28.0]
[346, 314, 331]
p02761
u177070195
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\ns = [list(map(int, list(input().split()))) for i in range(M)]\n\nans = [-1] * M\nfor i in s:\n if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:\n print(-1)\n return \n ans[i[0] - 1] = i[1]\n\nans = [int(str(a).replace('-1', '0')) for a in ans]\nres = ''.join((map...
['Runtime Error', 'Accepted']
['s892770792', 's117786946']
[3064.0, 3064.0]
[18.0, 17.0]
[377, 565]
p02761
u179376941
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().split())\ndic = {}\nflag = True\nfor _ in range(m):\n digit, num = map(int, input().split())\n if dic.get(digit, None):\n if dic[digit] != num:\n flag = False\n break\n if digit == 1 and num == 0 and n != 1:\n flag = False\n break\n if not dic.get(digit, None):\n dic[...
['Wrong Answer', 'Accepted']
['s435824678', 's103295465']
[9140.0, 9220.0]
[31.0, 33.0]
[479, 523]
p02761
u183657342
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\n\nans = [0]*n \n\nfor i in range(m):\n s, c = map(int, input().split())\n if ans[s-1] == 0:\n ans[s-1] = c \n elif not ans[s-1] == c:\n print(-1)\n break\n if i == m-1:\n if ans[0] == 0:\n print(-1)\n else:\n for j ...
['Runtime Error', 'Accepted']
['s062673009', 's801641167']
[3064.0, 3064.0]
[18.0, 18.0]
[379, 416]
p02761
u184661160
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['#graph implementation\nimport math\nn,m=map(int,input().split())\nans=[0]*n\nfor i in range(m):\n s,c=map(int,input().split())\n if ans[s-1]==0:\n ans[s-1]=c\n else:\n if ans[s-1]>=c and c>0:\n ans[s-1]=c\nif len(ans)<3:\n for i in ans:\n print(i,end="")\nelif ans[0]==0...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s038778337', 's453358395', 's532638420', 's643726730']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0, 18.0]
[380, 394, 416, 435]
p02761
u185325486
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\nketa = ['?']*N\n\nfor _ in range(M):\n s, c = map(int, input().split()) \n if keta[s-1] == '?' or keta[s-1] == c:\n keta[s-1] = c\n else:\n return -1\nif keta[0] == 0:\n return -1\n\nketa = [0 if num == '?' else num for num in keta]\n\nprint(''.join(m...
['Runtime Error', 'Accepted']
['s132979169', 's306399639']
[3064.0, 3064.0]
[17.0, 17.0]
[319, 538]
p02761
u185502200
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int,input().split())\n\nl = [[0 for _ in range(2)] for _ in range(m)]\n\nf = 0\ncon = ""\n\nfor i in range(n):\n s, c = map(int,input().split()))\n if l[s-1][1] == 0 or l[s-1][0] == c:\n if s == 1 and c == 0:\n f = 1\n break\n l[s-1][0] = c\n l[s-1][1] = 1\n...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s414429500', 's572253299', 's884316310', 's969758035', 's776348728']
[2940.0, 3064.0, 3316.0, 3064.0, 3064.0]
[17.0, 17.0, 20.0, 17.0, 18.0]
[566, 576, 544, 449, 548]
p02761
u186974762
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = [int(a) for a in input().split()]\nS = [[int(i) for i in input().split()] for _ in range(M)]\nflag = 0\nNUM = 0\nLIST = [-1 for _ in range(N)]\nfor s,c in S:\n s -= 1\n if(LIST[s]==-1):\n NUM += c*(10**(N-s-1))\n LIST[s] = c\n else:\n if(LIST[s]!=c):\n flag = 1\n print(-1)\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s040784654', 's388364059', 's728336817', 's938290507']
[3060.0, 2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[717, 691, 691, 577]
p02761
u188827677
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m = map(int, input().split())\n\np = ['0']*n\nfor i in range(m):\n s,c = input().split()\n s = int(s)\n p[s-1] = c\n\nt = 0\nfor i in p:\n t += int(i)\n\nif len(str(t)) == n:\n print(int(t))\nelse:\n print(-1)", "import sys\nn,m = map(int, input().split())\n\np = [0]*n\nq = [False]*n\nfor i in range(m):\n s,...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s443884647', 's504951073', 's530948331']
[3064.0, 2940.0, 9244.0]
[19.0, 18.0, 30.0]
[202, 402, 432]
p02761
u189089176
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['# C - Guess The Number\n\n\nN,M = list(map(int,input().split()))\n\ndigit_num_list = [list(map(int, input().split())) for i in range(0,M)]\n\n\nmin = ["1"]\nfor n in range(1,N):\n min.append("0")\nmin = int("".join(min))\n\nmax = []\nfor n in range(0,N):\n max.append("9")\nmax = int("".join(max))\n\nprint(min)\...
['Wrong Answer', 'Accepted']
['s497575885', 's922770858']
[3064.0, 3064.0]
[18.0, 21.0]
[1140, 292]
p02761
u189326411
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int, input().split())\n\nlst = []\nfor i in range(m):\n s,c = map(int, input().split())\n lst.append((s,c))\n\nfor i in range(1,1000):\n flag = 0\n I = str(i)\n if len(I)==n:\n for j in range(len(lst)):\n if I[lst[j][0]-1]!=lst[k][1]:\n flag = 1\n if fl...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s045065165', 's237857917', 's544002807']
[3188.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[343, 454, 690]
p02761
u189487046
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\n\nSC = []\nfor _ in range(M):\n s, c = map(int, input().split())\n SC.append([s, c])\n\nfor i in range(1000):\n str_i = str(i)\n if len(str_i) != N:\n break\n\n for sc in SC:\n index = sc[0]-1\n\n if len(str_i) != N:\n break\n if ...
['Wrong Answer', 'Accepted']
['s016841342', 's066407218']
[3064.0, 3064.0]
[17.0, 18.0]
[400, 403]
p02761
u189516107
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\ns = []\nc = []\nfor i in range(M):\n si, ci = map(int, input().split())\n s.append(si)\n c.append(ci)\n#print(s, c)\n\nfor i in range(M):\n if s[i] == 1 and c[i] == 0:\n print(-1)\n exit()\n \nfor i in range(M):\n for j in range(M):\n if i != j and s[i] == s[j] and c[i...
['Wrong Answer', 'Accepted']
['s469316424', 's248279868']
[3064.0, 3064.0]
[17.0, 18.0]
[419, 506]
p02761
u192433528
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\nL = [list(map(int,input().split())) for i in range(M)]\ndict = {}\n\nif M == 0 :\n print(10**(N-1))\n exit()\n\nfor x in L :\n dict.setdefault(x[0],[])\n dict[x[0]].append(x[1])\n\nfor k,v in dict.items():\n dict[k] = set(v)\n\nansList = ["0"]*N\nfor i in range(N) :\n ...
['Wrong Answer', 'Accepted']
['s011366020', 's310571650']
[9176.0, 9184.0]
[31.0, 28.0]
[688, 713]
p02761
u193927973
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M=map(int, input().split())\nans=["-1"]*M\nf=0\nfor i in range(M):\n s, c=map(int, input().split())\n if s==1 and c==0:\n f=1\n if ans[s-1]!=str(c) and ans[s-1]!="-1":\n f=1\n ans[s-1]=str(c)\n\nif f==1:\n print(-1)\nelse:\n a="".join(ans)\n b=a.replace("-1", "1")\n print(b)\n ', 'N, M=map(int, inp...
['Runtime Error', 'Runtime Error', 'Accepted']
['s744438478', 's792034366', 's453472834']
[3064.0, 3060.0, 3188.0]
[17.0, 17.0, 20.0]
[280, 239, 369]
p02761
u194228880
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["in1 = input('')\nn = int(in1.split(' ')[0])\nm = int(in1.split(' ')[1])\nl = []\nfor i in range(0,n):\n l.append(0)\n\nhasError = False\nfor i in range(0,m):\n in2 = input('')\n idx = int(in2.split(' ')[0])\n li = int(in2.split(' ')[1])\n if l[idx-1] != li:\n hasError = True\n else:\n l[idx-1] = li\n\nres...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s041764682', 's217671542', 's699620172']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[565, 424, 686]
p02761
u194472175
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N,M=map(int,input().split())\ns=[]\nc=[]\nfor i in range(M):\n a,b=map(int,input().split())\n s.append(a)\n c.appemd(b)\nfound=False\nstart=pow(10,N-1)\nstop=pow(10,N)\nif N==1:\n start=0\nfor i in range(start,stop):\n i_str=str(i)\n passed=True\n for j in range(M):\n if not i_str[s[j]-1]=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s102045136', 's513884005', 's920061787']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 20.0]
[452, 372, 675]
p02761
u197300773
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import sys\nn,m=map(int,input().split())\ns=[]\nc=[]\nfor i in range(m):\n ts,tc=map(int,input().split())\n ts-=1\n s.append(ts)\n c.append(tc)\n\nif n==1:\n ans=min(c)\n for i in range(m):\n if ans!=c[i]:\n print(-1)\n sys.exit()\n\nif n!=1:\n ans=[1]+[0 for i in ran...
['Runtime Error', 'Accepted']
['s165639006', 's037321840']
[3064.0, 3064.0]
[17.0, 17.0]
[598, 453]
p02761
u199830845
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["\n N, M = map(int, input().split())\n s_list = list()\n c_list = list()\n for _ in range(M):\n s, c = input().split()\n s_list.append(s)\n c_list.append(c)\n\n out = '-1'\n exists = True\n\n num = 'd' * N\n\n for index in range(len(s_list)):\n if num[int(s_list[inde...
['Runtime Error', 'Accepted']
['s250499585', 's326307832']
[2940.0, 3064.0]
[17.0, 17.0]
[749, 766]
p02761
u201387466
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\nS = [list(map(int,input().split())) for _ in range(M)]\nans = [0 for _ in range(N)]\ncheck = [0 for _ in range(N)]\nfor i in range(M):\n s = S[i][0]\n c = S[i][1]\n if check[s-1] == 0:\n check[s-1] = 1\n ans[s-1] = c\n else:\n if ans[s-1] != c:\n ...
['Runtime Error', 'Accepted']
['s384373256', 's843894166']
[3064.0, 3064.0]
[17.0, 17.0]
[582, 789]
p02761
u201928947
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int,input().split())\nans = []\nfor i in range(n):\n ans.append(0)\nfor k in range(m):\n s,c = map(int,input().split())\n if c == 0:\n c = 10 \n if ans[s-1] == 0 or ans[s-1] == c:\n ans[s-1] = c\n else:\n print(\'-1\')\n exit()\nif n != 0:\n if ans[0] == 10:\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s901866475', 's975108912', 's456241490']
[3064.0, 3064.0, 3188.0]
[17.0, 18.0, 20.0]
[489, 448, 468]
p02761
u202560873
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['S = input()\nQ = int(input())\n\nc2 = 0\nquery = []\nfor i in range(Q):\n q = [x for x in input().split()]\n T = int(q[0])\n if T == 1:\n query.append([T])\n else: # T == 2\n F, C = int(q[1]), q[2]\n query.append([T, F, C])\n c2 += 1\n\nwhile len(query) > c2 + 1:\n print(que...
['Runtime Error', 'Accepted']
['s661657742', 's945693165']
[9224.0, 9176.0]
[24.0, 30.0]
[968, 608]
p02761
u202570162
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['# C\nN,M=map(int,input().split())\ncnd=[tuple(int(i) for i in input().split()) for j in range(M)]\nans=-1\nfor n in range(10**N-1):\n # print(n)\n flag=True\n n_str=str(n)\n for s,c in cnd:\n if n_str[s-1]!=str(c):\n # print(n_str[s-1],c)\n flag=False\n break\n i...
['Runtime Error', 'Accepted']
['s082736449', 's093862441']
[3064.0, 3064.0]
[17.0, 19.0]
[351, 389]
p02761
u203382704
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\nnum = [list(map(int, input().split())) for _ in range(M)]\nans = [-1] *N\nfor k in range(M):\n if ans[num[k][0] -1] == -1 or ans[num[k][0] -1] == num[k][1]:\n ans[num[k][0] -1] = num[k][1]\n else:\n ans[0] = 0\n break\n\nif ans[0] == 0:\n print(-1)\nelse...
['Wrong Answer', 'Accepted']
['s968096042', 's309837120']
[3064.0, 3064.0]
[17.0, 17.0]
[385, 662]
p02761
u204208382
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int, input().split())\ns_and_c = []\nfor i in range(m):\n s_and_c.append(list(map(int, input().split())))\n\nans = ["-1" for i in range(n)]\ns_and_c.sort()\n\n\nif m == 0:\n if n == 1:\n ans = ["0"ß]\n else:\n ans[0] = "1"\n\nelif n != 1 and s_and_c[0][0] == 1 and s_and_c[0][1] == 0:\...
['Runtime Error', 'Accepted']
['s054980844', 's954984031']
[2940.0, 3064.0]
[17.0, 18.0]
[686, 759]
p02761
u207799478
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n)//math.factorial(n-r)*math.factorial(r)\n\n\nn, m = map(int, input().split())\nsc = [input().split() for i in range(m)]\n# print(sc)\n# print(len(sc))\nif len(sc) == 1:\n pri...
['Runtime Error', 'Runtime Error', 'Accepted']
['s650739857', 's829129912', 's388357310']
[3832.0, 3832.0, 3896.0]
[24.0, 24.0, 29.0]
[798, 802, 678]
p02761
u210827208
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m=map(int,input().split())\nx=[]\nfor _ in range(n):\n x.append([])\n\nfor _ in range(m):\n s,c=map(int,input().split())\n x[s-1].append(c)\nans=''\nfor i in range(n):\n if len(set(x[i]))>=2:\n ans='-1'\n break\n elif len(x[i])==0 and i==0:\n ans+='1'\n elif len(x[i])==0 and i...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s352732247', 's548058556', 's579536537', 's194226444']
[3064.0, 3064.0, 3064.0, 3064.0]
[19.0, 17.0, 17.0, 18.0]
[503, 292, 356, 570]
p02761
u211706121
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nnum="a"*n\nflag=False\n\nfor i in range(m):\n s,c=map(int,input().split())\n s-=1\n if num[s]=="a" or num[s]==str(c):\n num=num[:s]+str(c)+num[s+1:]\n else:\n flag=True\nif flag or num[0]=="0":\n print(-1)\nelse:\n if num[0]!="a":\n num="1"+num[1:]\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s411939125', 's783134836', 's932377715']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 18.0]
[334, 290, 383]
p02761
u211805975
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["#ABC157 Guess the number\nn,m = map(int,input().split())\nsc = [input().split() for _ in range(m)]\nif len(sc) == 0:\n print('0')\n exit()\n\nif n == 1:\n ans = []\n for i in range(m):\n ans.append(sc[m][1])\n if set(ans) == 1:\n print(ans[0])\n else:\n print('-1')\n exit()\n...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s146088287', 's251174513', 's310263080', 's068088812']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 19.0, 18.0, 19.0]
[565, 360, 396, 655]
p02761
u212328220
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int,input().split())\nlst = []\nfor _ in range(m):\n lst.append(list(map(int,input().split())))\n\nnumber = [[] for _ in range(n)]\nfor v in lst:\n keta,num = v[0]-1,v[1]\n if not number[keta]:\n number[keta] = num\n else:\n if number[keta] != num:\n print(-1)\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s715672312', 's728049184', 's945059247', 's918300419']
[9116.0, 9224.0, 9180.0, 9224.0]
[33.0, 25.0, 29.0, 29.0]
[881, 888, 881, 916]
p02761
u215286521
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = list(map(int, input().split()))\n\ns = [0] * m\nc = [0] * m\n\nfor i in range(m):\n s[i], c[i] = list(map(int, input().split()))\n\nresult = [0] * n\n\nfor i in range(m):\n if result[s[i]-1] == 0:\n result[s[i]-1] = c[i]\n elif result[s[i]-1] > c[i]:\n result[s[i]-1] = c[i]\n\nprint(result)\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s171737429', 's200884466', 's198039699']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 18.0]
[395, 453, 428]
p02761
u215341636
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n, m = map(int, input().strip().split())\na = [input().split() for i in range(m)]\nans = ['a'] * n\n\n\nfor i in range(m):\n ind = int(a[i][0]) - 1\n if ans[ind] != 'a':\n ans = '-1'\n break\n else:\n ans[ind] = a[i][1]\n\nprint(''.join(ans))", "def solve(n, m):\n ans = [-1] * n\n for _ in range(m):...
['Wrong Answer', 'Accepted']
['s831143925', 's756636532']
[3060.0, 3064.0]
[17.0, 17.0]
[241, 609]
p02761
u216011776
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['\nif __name__ == \'__main__\':\n n, m = [int(i) for i in input().split()]\n\n d = {}\n for i in range(1, n + 1):\n d[i] = 0\n\n\n result = -1\n for i in range(m):\n s, c = [int(i) for i in input().split()]\n \n if d[s] != 0:\n print(result)\n exit()\n ...
['Wrong Answer', 'Accepted']
['s333313595', 's362819449']
[3064.0, 3064.0]
[19.0, 22.0]
[494, 697]
p02761
u216392490
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import sys\nimport math\nsys.setrecursionlimit(int(1e6))\n\nN, M = map(int, input().split())\ns = [0]*M\nc = [0]*M\nfor i in range(M):\n s[i], c[i] = map(int, input().split())\n\ndigits = [-1]*N\nfault = False\nfor i in range(M):\n d = s[i]-1\n if digits[d] >= 0:\n fault = True\n break\n dig...
['Wrong Answer', 'Accepted']
['s469825907', 's431849419']
[3064.0, 3064.0]
[17.0, 17.0]
[539, 654]