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
u552176911
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...
['print(-1)', 'import sys\n\nn, m = list(map(int, input().split()))\nar = [list(map(int, input().split())) for _ in range(m)]\nans = [0 for _ in range(n)]\n\nfor a in ar:\n if ans[a[0] - 1] != 0:\n print("-1")\n sys.exit()\n ans[a[0] - 1] = a[1]\n\nif ans[0] == 0:\n ans[0] = 1\n\nans = int("".joi...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s097654118', 's636336666', 's803159546', 's891859800', 's904476384']
[2940.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0, 17.0, 18.0]
[9, 307, 305, 255, 531]
p02761
u553308611
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...
['vN, M = map(int, input().split())\ns = [-1]\nc = [-1]\nOK = True\nx = 0\nfor i in range(M):\n s_, c_ = map(int, input().split())\n if N != 1 and s_ == 1 and c_ == 0:\n OK = False\n ok = True\n for i in range(len(s)):\n if s[i] == s_:\n ok = False\n if c[i] != c_:\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s109900890', 's302689228', 's632855763']
[3064.0, 3064.0, 3064.0]
[17.0, 19.0, 18.0]
[552, 454, 551]
p02761
u556225812
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\nlst = [[] for i in range(3)]\nfor i in range(M):\n a, b = map(int, input().split())\n if b not in lst[a-1]:\n lst[a-1].append(b)\nfor i in range(3):\n if len(lst[i]) > 1:\n print(-1)\n exit()\n if i == 0:\n if not lst[i]:\n ...
['Wrong Answer', 'Accepted']
['s810763844', 's042754276']
[3064.0, 3064.0]
[17.0, 18.0]
[679, 397]
p02761
u557565572
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\n\n# import heapq\n# from collections import deque\nimport numpy as np\n\nn, m = map(int, input().split())\ns, c = [0] * m, [0] * m\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n\n# replace = [False] * n\nnumber = ['a'] * n\nans = 0\nfor i in range(m):\n\n if number[s[i]-1] != 'a' ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s569917412', 's900740734', 's071977312']
[21024.0, 3064.0, 3064.0]
[306.0, 19.0, 17.0]
[702, 690, 531]
p02761
u558242240
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 = [tuple(map(int, input().split())) for _ in range(m)]\nsc = sorted(sc, reverse=True, key=lambda x:x[0])\nif m == 0:\n print(-1)\n exit()\nif sc[0][0] != n:\n print(-1)\n exit()\nans = [0] * n\nans[0] = 1\nprev = sc[0]\nfor i in range(1, m):\n if prev[0] == sc[i][0]...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s807081049', 's851179460', 's759448845']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[454, 431, 518]
p02761
u559196406
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\nans = [0]*n\njudge_s = 0\njudge_c = 0\nsc = sorted(sc)\nfor i in range(m):\n if judge_s == sc[i][0] and judge_c != sc[i][1]:\n ans = -1\n break\n judge_s = sc[i][0]\n judge_c = sc[i][1]\n ans[sc[i][0]-...
['Runtime Error', 'Runtime Error', 'Accepted']
['s615096884', 's684327067', 's397096993']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[478, 736, 737]
p02761
u563676207
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...
['# input\nN, M, K = map(int, input().split())\n\nFrends = [[] for _ in range(N)]\nfor _ in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n if a < b:\n Frends[a].append(b)\n else:\n Frends[b].append(a)\n\nBlocked = [[] for _ in range(N)]\nfor _ in range(K):\n c, d = map(...
['Runtime Error', 'Accepted']
['s377693504', 's696573910']
[3192.0, 3064.0]
[18.0, 17.0]
[1757, 568]
p02761
u563838154
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 operator import itemgetter\nn,m = map(int,input().split())\nt = [list(map(int,input().split())) for _ in range(m)]\nt.sort(key=itemgetter(0))\nc = [i[1] for i in t ]\ns = [i[0] for i in t]\n# print(c)\nx = 0\n\nans = "aaa"\nans = list(ans)\nfor i in range(3):\n for j in range(len(s)):\n if i==s[j]-1 :\...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s053394949', 's135622684', 's634337347', 's884529270', 's333824450']
[3064.0, 3064.0, 3064.0, 3316.0, 3064.0]
[18.0, 17.0, 17.0, 21.0, 18.0]
[898, 567, 953, 576, 683]
p02761
u564655959
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 calculate(n, m, condition_list):\n if [1, 0] in condition_list:\n return '-1'\n \n \n result = ['null']*n\n for condition in condition_list:\n if result[condition[0]-1] != 'null':\n if not result[condition[0]-1] == condition[1]:\n return '-1'\n result[...
['Runtime Error', 'Accepted']
['s289262638', 's257810856']
[3064.0, 3064.0]
[18.0, 17.0]
[1084, 1099]
p02761
u564770050
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)]\ntemp = [-1] * n\nans = -1\n\nfor i in sc:\n if temp[i[0]-1] != -1 and temp[i[0]-1] != i[1]:\n print(-1)\n exit()\n temp[i[0]-1] = i[1]\n\nif n == 1:\n mini = 0\n maxi = 10\nif n == 2:\n mini = 10\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s293411606', 's457040534', 's865596231']
[3064.0, 3444.0, 3064.0]
[18.0, 21.0, 18.0]
[577, 493, 560]
p02761
u569272329
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 = []\nfor i in range(0, M):\n a = tuple(map(int, input().split()))\n A.append(a)\nfor x in range(10**(N-1)-1, 10**N):\n ans = str(x)\n flag = True\n for a in A:\n if ans[a[0]-1] != str(a[1]):\n flag = False\n if flag:\n print(x)\n e...
['Runtime Error', 'Accepted']
['s781184373', 's465301807']
[3060.0, 3064.0]
[19.0, 17.0]
[322, 359]
p02761
u572425901
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 = []\nfor i in range(M):\n SC.append(list(map(int, input().split())))\nflag = 0\nN, M = 3, 1\nSC = [[1, 0]]\na = ""\nA = [[] for row in range(N)]\nfor i, S in enumerate(SC):\n if not (str(S[1]) in A[S[0]-1]):\n A[S[0]-1].append(str(S[1]))\nfor i in range(0,N):\n if...
['Wrong Answer', 'Accepted']
['s791373654', 's786129224']
[3064.0, 3064.0]
[18.0, 18.0]
[601, 592]
p02761
u575239123
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...
['l=[10]*3\nn,m=map(int,input().split())\nfor i in range(m):\n s,c=map(int,input().split())\n if c<l[s-1]:\n l[s-1]=c\nl=l[::-1]\nfor i in range(len(l)):\n if l[i]==10:\n l[i]=str(0)\n else:\n l[i]=str(l[i])\nans=int("".join(l))\nif ans==0:\n print(1)\n exit(0)\nif len(str(ans))!=n:\n print(-1)\nelse:\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s145742162', 's277480285', 's517893163', 's194630460']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[311, 280, 279, 267]
p02761
u575956662
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())\nnum = [0]*n\nnum[0] = 1\nAns = 0\nfor i in range(m):\n s,c = map(int, input().split())\n if num[s-1] != 0 and num[s-1] != c:\n print(-1)\n sys.exit()\n else:\n num[s-1] = c\nprint(num)\nfor i in range(len(num)):\n Ans = Ans + num[i] * (10 *...
['Wrong Answer', 'Accepted']
['s459850250', 's350650048']
[9152.0, 9252.0]
[32.0, 31.0]
[325, 539]
p02761
u576917603
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=[[int(i) for i in input().split()] for i in range(m)]\n\nnumber=[99]*n\nif m==0 and n==1:\n print(0)\n exit()\nif m==0 and n==2:\n print(10)\n exit()\nif m==0 and n==3:\n print(100)\n exit()\nflag=True\nfor x,y in a:\n if number[x-1]!=99:\n if number[x-1]!=y...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s029415431', 's089551836', 's359291944', 's585450414', 's786038700', 's202130569']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0, 18.0, 17.0, 18.0]
[558, 377, 368, 336, 429, 274]
p02761
u578501242
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\nimport sys\nlist = [int(i) for i in input().split()]\na=list[0]\nb=list[1]\n\ntablec = np.array([[int(i) for i in input().split()] for b in range(b)])\n\nx=0\ny=0\nz=0\nt=-1\nk=0\np=0\nfor i in range(1000):\n\tif t!=-1:\n\t\texit\n\telse:\n\t\tt=0\n\t\tx= i // 100\n\t\ty= (i//10) % 10\n\t\tz=i % 1...
['Wrong Answer', 'Accepted']
['s320921449', 's375293279']
[12452.0, 3064.0]
[154.0, 18.0]
[496, 536]
p02761
u580073714
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 itertools\n\nN, M = map(int, input().split())\na = [[0] * 10] * N\n\nfor i in range(N):\n if i == 0:\n a[i] = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n else:\n a[i] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nflag = 1\n\nfor i in range(M):\n s, c = map(int, input().split())\n if (N > 1 and s == 1 and c == 0) or a[s-1] !...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s369411841', 's765097752', 's794174317', 's620636660']
[3064.0, 3192.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0, 18.0]
[488, 523, 521, 551]
p02761
u580697892
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())\nd = {}\nS = ["0" for _ in range(N)]\nfor _ in range(M):\n s, c = map(str, input().split())\n if s not in d.keys():\n d[s] = c\n else:\n if d[s] != c:\n print(-1)\n exit()\nif N == 1:\n ans = "".join(S)\n print(ans)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s635200424', 's671735968', 's110179906']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[429, 398, 464]
p02761
u581603131
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)]\na = 0\nfor i in range(M):\n if SC[i][0] != N or (SC[i][0] ==3 and SC[i][1]==0):\n a += 1\n\nhandred = 0\nten = 0\none = 0\n\nfor i in range(M):\n if S[i][0] == 3:\n handred = 9\n elif S[i][0] == 2:\n ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s054367322', 's241702238', 's393174427', 's552053871', 's610276646', 's921799784', 's505166855']
[3064.0, 3064.0, 3064.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 18.0]
[846, 229, 861, 216, 828, 210, 234]
p02761
u585348179
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 i in range(m):\n sc.append(list(map(int, input().split())))\nfor i in range(10**N):\n anc = str(i)\n if len(ans) == N and all(ans[s-1] == str(c) for s,c in sc):\n print(ans)\n quit()\nprint(-1)', 'N,M=map(int, input().split())\n\nsc = []\nfor i in r...
['Runtime Error', 'Runtime Error', 'Accepted']
['s055592167', 's470560660', 's718821294']
[3064.0, 3316.0, 3064.0]
[17.0, 20.0, 18.0]
[252, 252, 252]
p02761
u585963734
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...
["if M==0:\n if N>=2:\n print(-1)\n exit(0)\n elif N==1:\n print(0)\n exit(0)\n \nif N!=1 and A[0][0]==1 and A[0][1]==0:\n print(-1)\n exit(0)\ni=1\nj=len(A)\nwhile i<j:\n if A[i][0]==A[i-1][0] and A[i][1]==A[i-1][1]:\n A.pop(i)\n j-=1\n continue\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s322254492', 's996595716', 's132050160']
[9136.0, 9096.0, 9232.0]
[25.0, 30.0, 31.0]
[587, 606, 772]
p02761
u586639900
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())\n\nS = []\nC = []\nfor m in range(M):\n s, c = map(int, input().split())\n S.append(s)\n C.append(c)\n\nfor i in range(10**N):\n tes = str(i)\n flag = True\n if len(tes) < N:\n flag = False\n for s, c in zip(S, C):\n if tes[s-1] != str(c):\n flag = Fals...
['Runtime Error', 'Runtime Error', 'Accepted']
['s535020702', 's592770790', 's311524096']
[9208.0, 9208.0, 9144.0]
[26.0, 28.0, 27.0]
[355, 330, 355]
p02761
u586662847
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 resolve():\n N, M = map(int, input().split())\n\n req = [list(map(int, input().split())) for i in range(M)]\n\n min_range = 10 ** (N - 1)\n max_range = 10 ** (N)\n\n for i in range(min_range, max_range):\n st = str(i)\n ok = True\n for s, c in req:\n if int(st[s - 1]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s102940930', 's172961910', 's394402988']
[3064.0, 3064.0, 3060.0]
[17.0, 17.0, 21.0]
[416, 681, 269]
p02761
u591143370
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 = [0] * M\nc = [0] * M\n\nfor i in range(M):\n s[i], c[i]= map(int, input().split())\n \nn=[-1]*N\nw=True\nfor i in range(M):\n if n[s[i]-1]==-1:\n n[s[i]-1]=c[i]\n if n[s[i]-1]!=-1 and n[s[i]-1]==c[i]:\n n[s[i]-1]=c[i]\n if n[s[i]-1]!=-1 and n[s[i]-1]!=...
['Runtime Error', 'Accepted']
['s609105196', 's737876422']
[3064.0, 3064.0]
[17.0, 17.0]
[616, 618]
p02761
u593364182
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\nt=[-1]*N\nfor i in range(m):\n s,c=map(int,input().split())\n s-=1\n if t[s] != -1 and t[s] != c:\n print(-1)\n exit()\n t[s]=c\n\nif n != 1:\n if t[0] == 0:\n print(-1)\n exit()\n if t[0] == -1:\n t[0]=1\n for i in range(1,n):\n if t[i] == -1:\n t[i] = 0\...
['Runtime Error', 'Accepted']
['s372167755', 's051697747']
[3064.0, 3064.0]
[18.0, 19.0]
[361, 362]
p02761
u595064211
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\nN, M = map(int, input().split())\n\nA = []\nbit = []\nfor i in range(N):\n A.append(9)\n bit.append(0)\n# print(A)\n\nans = "0"\nif N==1 and M==0:\n ans = "-1"\n\nfor j in range(M):\n s, c = map(int, input().split())\n if ans == "-1":\n continue\n if bit[s-1]==1 and A[s-1] != c:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s131303908', 's656632457', 's883085516', 's947783361']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[821, 617, 616, 486]
p02761
u595289165
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())\nans = [-1]*n\nfor _ in range(m):\n s, c = map(int, input().split())\n if ans[s-1] == -1 or ans[s-1] == c:\n ans[s-1] = c\n if s == 0 and c == 0:\n print(-1)\n sys.exit()\n else:\n print(-1)\n sys.exit()\n\nif ans[0] == -1:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s531832923', 's975014470', 's073353546']
[3064.0, 3064.0, 3060.0]
[17.0, 17.0, 18.0]
[443, 443, 358]
p02761
u596505843
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\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\nnum = [1] * N\nseen = {}\nfor i in range(M):\n\ts, c = map(int, input().split())\n\tif s in seen:\n\t\tif seen[s] != c:\n\t\t\tprint(-1)\n\t\t\texit()\n\tif s == 1 and c == 0:\n\t\tif N == 1:\n\t\t\tprint(0)\n\t\t\texit()\n\t\telse:\n\t\t\tpr...
['Wrong Answer', 'Accepted']
['s489239778', 's012167184']
[3064.0, 3064.0]
[17.0, 17.0]
[359, 398]
p02761
u597622207
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())\nresult = [0] * N\n\nfor i in range(M):\n s,c = map(int, input().split())\n if s == 1 and c == 0 and N != 1:\n print(-1)\n exit()\n if result[s-1] != 0:\n print(-1)\n exit()\n else:\n result[s-1] = c\n\nif len(result) >= 2 and result[0] =...
['Wrong Answer', 'Accepted']
['s213044129', 's935907129']
[3064.0, 3064.0]
[18.0, 18.0]
[360, 381]
p02761
u599114793
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...
['ans = [-1] * n\nfor i in range(m):\n if ans[sc[i][0]-1] == -1 or ans[sc[i][0]-1] == sc[i][1]:\n ans[sc[i][0]-1] = sc[i][1]\n else:\n print(-1)\n exit()\nif n == 1 and ans[0] != -1:\n print(ans[0])\n exit()\nif ans[0] == 0:\n print(-1)\n exit()\nif n == 2 and ans[0] != -1 and ans...
['Runtime Error', 'Accepted']
['s463338362', 's137887977']
[3064.0, 3064.0]
[17.0, 19.0]
[754, 382]
p02761
u602773379
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())\nlines=[]\nlines_s=[]\nans=0\nfor line in range(M):\n\ts,c=map(int,input().split())\n\tif N>=s and s not in lines_s:\n\t\tans+=c*(10**(N-s))\n\t\tlines.append([s,c])\n\t\tlines_s.append(s)\n\telif [s,c] in lines:\n\t\tprint("repeat")\n\t\tcontinue\n\n\telse:\n\t\tans=-1\n\t\tbreak\nprint(...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s032911435', 's304730624', 's848938665', 's019836763']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 18.0]
[413, 297, 395, 709]
p02761
u603958124
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 = [0]*m\nc = [0]*m\nnum = ['']*n\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n if s[i]==1 and c[i]==0:\n print(-1)\n exit()\n elif num[s[i]-1] == '':\n num[s[i]-1] = c[i]\n elif num[s[i]-1] != c[i]:\n print(-1)\n exit(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s223191861', 's975593618', 's617971895']
[9232.0, 9128.0, 9948.0]
[29.0, 25.0, 38.0]
[392, 400, 1049]
p02761
u606090886
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 for i in range(n)]\n\nfor i in range(m):\n r,s = map(int,input().split())\n if r-1 == 0 and s = 0:\n ans = [-1]\n break\n if ans[r-1] != 0 and ans[r-1] != s:\n ans = [-1]\n break\n ans[r-1] = s\nif ans[0] == 0:\n ans[0] = 1\nsum = ...
['Runtime Error', 'Accepted']
['s420688727', 's290815970']
[2940.0, 3064.0]
[17.0, 17.0]
[365, 388]
p02761
u606146341
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 s, c = map(int, input().split())\n lst.append([s-1,c])\n \nans = []\nfor _ in range(10**(n)):\n i = 1\n nums = list(str(_))\n while len(nums) < n:\n nums.insert(0,'0')\n for s in lst:\n if nums[s[0]] != str(s[1]): \n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s067681184', 's617177340', 's681376552', 's691217780', 's798138913', 's866582945']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[19.0, 18.0, 18.0, 17.0, 18.0, 18.0]
[488, 433, 584, 589, 416, 442]
p02761
u606523772
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 = []\ndic_A = {}\nflag = True\nfor i in range(M):\n A = list(map(int, input().split()))\n if A[0] in dic_A:\n if dic_A[A[0]]!=A[1]:\n flag = False\n else:\n dic_A[A[0]] = A[1]\n A_list.append(A)\nfor i in range(M):\n if A_list[i][0]==1 a...
['Runtime Error', 'Accepted']
['s612930161', 's499428863']
[3188.0, 3064.0]
[18.0, 19.0]
[1124, 384]
p02761
u607074939
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 s,c = map(int, input().split())\n S.append(s)\n C.append(c)\nfor n in range(1000):\n if len(str(n))==N:\n count = 0 \n if n==0:\n l=[0]\n else:\n l = []\n while n > 0:\n ...
['Wrong Answer', 'Accepted']
['s238220774', 's679420061']
[3188.0, 3064.0]
[19.0, 20.0]
[582, 595]
p02761
u607563136
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\n# sc = [list(map(int,input().split())) for _ in range(m)]\n\na = [""]*3\nrep = []\nans = 0\n\nfor i in range(m):\n s,c = input().split()\n if s in rep:\n if c != a[int(s)-1]:\n ans = -1\n rep.append(s)\n a[int(s)-1] = c\n \nprint(a)\n\nif ans == -1:\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s656366914', 's795770949', 's149766669']
[9184.0, 9216.0, 9108.0]
[28.0, 28.0, 31.0]
[606, 533, 241]
p02761
u608178601
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)]\nfor i in range(1000):\n\tcount=0\n\tif len(str(i))==N:\n\t\tfor sc in SC:\n\t\t\ts,c=sc[0],sc[1]\n\t\t\tif s==1 and i//(100)==c and c!=0:\n\t\t\t\tcount+=1\n\t\t\tif s==2 and len(str(i))==2:\n\t\t\t\tif int(str(i)[0])==c and c!=0:\...
['Wrong Answer', 'Accepted']
['s608319554', 's208582297']
[9136.0, 9168.0]
[27.0, 31.0]
[577, 518]
p02761
u608579392
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()]\ns, c = [], []\nans_array = [None for _ in range(N)]\n\nfor i in range(M):\n s_i, c_i = [int(x) for x in input().split()]\n s.append(s_i)\n c.append(c_i)\n\nfor i in range(M):\n if ans_array[s[i] - 1] is None:\n ans_array[s[i] - 1] = c[i]\n else:\n ...
['Wrong Answer', 'Accepted']
['s512114195', 's152307609']
[3064.0, 3064.0]
[18.0, 18.0]
[590, 398]
p02761
u609814378
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())\n\n\nSClis = [] \nfor _ in range(M):\n a, b = map(int, input().split())\n SClis.append([a,b])\n\nans = [-1]*N\n\nfor i in range(M):\n singlelis = SClis[i]\n S = (singlelis[0] - 1)\n C = (singlelis[1])\n \n if ans[S] != -1 and ans[S] != C:\n pr...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s036103584', 's103896278', 's736107597', 's915497894']
[9248.0, 3064.0, 3064.0, 9152.0]
[27.0, 17.0, 18.0, 32.0]
[563, 462, 685, 718]
p02761
u610192658
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_list = []\n\ndef my_index(l, x, default=False):\n if x in l:\n return l.index(x)\n else:\n return default\n\nfor i in range(3):\n a, b, c = map(int, input().split())\n A_list.append(a)\n A_list.append(b)\n A_list.append(c)\n\nN = int(input())\nflag=True\n\nfor i in range(N):\n num = int(inp...
['Runtime Error', 'Accepted']
['s384085482', 's017203116']
[3188.0, 3064.0]
[18.0, 17.0]
[1165, 451]
p02761
u612975321
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...
['print(-1)', 'n, m = map(int,input().split())\nsc = [list(map(int,input().split())) for i in range(m)]\n\nflg = True\nfor ci in range(0, 10**n):\n cis = str(ci)\n if len(cis) != n:\n continue\n for j in range(m):\n s, c = sc[j][0]-1, sc[j][1]\n if int(cis[s]) != sc[j][1]:\n flg...
['Wrong Answer', 'Accepted']
['s435710128', 's232942895']
[9036.0, 9156.0]
[26.0, 29.0]
[9, 451]
p02761
u613920660
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 guess(N,M,S,C,guess_num):\n no_num=False\n if len(guess_num)!=1:\n guess_num[0]=1\n else:\n pass\n\n for m in range(M):\n if guess_num[S[m]-1]==0 or guess_num[S[m]-1]==C[m]:\n guess_num[S[m]-1]=C[m]\n else:\n no_num=True\n break\n \n i...
['Wrong Answer', 'Accepted']
['s360239570', 's494349252']
[3064.0, 3064.0]
[18.0, 18.0]
[805, 873]
p02761
u614181788
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 = [0]*m\nc = [0]*m\n\nfor i in range(m):\n s[i],c[i] = map(int,input().split())\n\nsw = [[0]*2]*m\nnum = [0]*m\nans = 0\nss = [0]*m\nfor i in range(m):\n if s[i] == 1 and c[i] == 0:\n ans = 1\n break\n if sw[s[i]-1][0] == 1 and sw[s[i]-1][1] - 1 != c[i]:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s433926161', 's481797860', 's129015064']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 19.0]
[491, 495, 445]
p02761
u616382321
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 _ in range(M):\n s, c = map(int, input().split())\n S.append(s)\n C.append(c)\n \n\nn = int('9'*N)\nans = []\n\nfor i in range(n+1):\n if len(str(i)) == 1:\n I = '00'+str(i)\n elif len(str(i)) == 2:\n I = '0'+str(i)\n else:\n ...
['Wrong Answer', 'Accepted']
['s091248763', 's352051586']
[9180.0, 9172.0]
[33.0, 26.0]
[599, 575]
p02761
u619144316
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 = []\nfor _ in range(M):\n SC.append([int(i) for i in input().split(' ')])\n\nfor n in range(10**(N-1),10**N):\n n = list(str(n))\n flg = 0\n for s,c in SC:\n if not n[s-1] == str(c):\n flg = 1\n\n if flg == 0:\n print(''.formatjo...
['Runtime Error', 'Accepted']
['s979962616', 's945169303']
[3064.0, 3064.0]
[19.0, 19.0]
[326, 580]
p02761
u619819312
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=[-1]*n\nfor i in range(m):\n s,c=map(int,input().split())\n if p[s-1]==-1:\n p[s-1]=c\n else:\n if c!=p[s-1]:\n print(-1)\n break\nelse:\n if p[0]==0 or p[0]!=-1:\n print(-1)\n else:\n s=""\n for i in range(n):\n ...
['Wrong Answer', 'Accepted']
['s662016167', 's059528157']
[3064.0, 3064.0]
[18.0, 17.0]
[411, 535]
p02761
u620238824
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 i in range(M)] 、複数行複数列\n\nA = [0] * N\n\nfor i, j in S:\n if i - 1 == 0 and j == 0:\n print(-1)\n exit() \n elif A[i-1] == 0 or A[i-1] == j:\n A[i - 1] = j\n else:\n print(-1)\n exit()\n\nif A[...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s252381790', 's321102758', 's166593751']
[3064.0, 3064.0, 9116.0]
[17.0, 18.0, 25.0]
[421, 366, 512]
p02761
u622847899
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=[]\nnum=[0]*N\n \n \nfor i in range(M):\n array=list(map(int,input().split()))\n s.append(array[0])\n c.append(array[1])\n \nfor i in range(1000):\n num=str(i)\n if N != len(num):\n continue\n \n for m in range(M):\n if num[s[m]-1] != str(c[m]):\n break\n\n prin...
['Wrong Answer', 'Accepted']
['s639544648', 's092158838']
[3064.0, 3064.0]
[17.0, 17.0]
[329, 564]
p02761
u624613992
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_list = [0] * n\nlist1 = []\nfor i in range(m):\n s, c = map(int, input().split())\n a = [s, c]\n list1.append(a)\nlist1.sort(reverse=True)\nfor i in range(m):\n s = list1[i][0]\n c = list1[i][1]\n if c == 0:\n ans_list[s - 1] = 0\n elif ans_list[s - 1]...
['Wrong Answer', 'Accepted']
['s858545153', 's554979467']
[3064.0, 9220.0]
[17.0, 27.0]
[539, 349]
p02761
u624617831
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 \n ans = []\n check = []\n false_flg = 0\n for i in range(n):\n ans.append(\'0\')\n check.append(0)\n\n for j in range(m):\n s, c = input().split()\n if check[int(s)-1] == 0:\n check[int(s)-1] = 1\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s133121323', 's221786038', 's776236180', 's342289566']
[3064.0, 3064.0, 3060.0, 3064.0]
[19.0, 18.0, 17.0, 18.0]
[534, 823, 341, 909]
p02761
u624696727
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\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI():...
['Wrong Answer', 'Accepted']
['s209233916', 's776882456']
[3064.0, 3064.0]
[18.0, 19.0]
[1047, 1052]
p02761
u625963200
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\nif n==0:\n ans=[0]\n for s,c in SC:\n if ans[s-1]==0:\n ans[s-1]=c\n else:\n if ans[s-1]!=c:\n prin\n t(-1)\n exit()\nelse:\n ans=[0]*n\n ans[0]=1\n for s,c in SC:\n if ans[s-1]==0:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s906762104', 's952305413', 's939923142']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 19.0]
[429, 280, 278]
p02761
u626464560
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())\nslist = []\nclist = []\n\ndef check(numlist, slist, clist):\n for i in range(m):\n if int(numlist[slist[i]]) != clist[i]:\n return False\n return True\n\nfor i in range(m):\n s,c = map(int, input().split())\n slist.append(s-1)\n clist.append(c)\nflag ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s295745215', 's802890974', 's101994598']
[2940.0, 2940.0, 3064.0]
[17.0, 18.0, 19.0]
[586, 586, 564]
p02761
u626881915
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+1)\n\nans = 0\nfor i in range(m):\n s,c=map(int,input().split())\n if a[s] == -1 or a[s] == c:\n a[s] = c\n else:\n print(-1)\n exit()\n\nif a[1] == 0:\n if n>1:\n print(-1)\n exit()\n else:\n print(ans)\nelse:\n ans = max(1, a[1])\n for i in range(2,...
['Runtime Error', 'Accepted']
['s548353100', 's170787720']
[3064.0, 3064.0]
[18.0, 18.0]
[344, 387]
p02761
u628581330
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())\ndigit = [\'-2\']*n\nfor i in range(m):\n s,c = input().split()\n s = int(s)\n if digit[s-1] == \'-2\' or digit[s-1] == c:\n digit[s-1] = c\n else:\n digit[s-1] = \'-1\'\nif (\'-1\' in digit) or (len(digit)!=1 and digit[0] == \'0\'):\n print(-1)\nelse:\n ...
['Runtime Error', 'Accepted']
['s215371447', 's136043492']
[3064.0, 3064.0]
[17.0, 18.0]
[335, 485]
p02761
u629350026
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=["a"]*n\nfor i in range(0,m):\n s,c=map(int,input().split())\n if ans[s-1]=="a" or ans[s-1]==c:\n ans[s-1]=c\n else:\n print(-1)\n break\nelse:\n for i in range(0,n):\n if ans[i]=="a":\n ans[i]=0\n if ans[0]==0:\n print(-1)\n else:\n if n==3:\n ans=i...
['Wrong Answer', 'Accepted']
['s870308625', 's759247268']
[3064.0, 3064.0]
[17.0, 18.0]
[458, 523]
p02761
u631755487
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(\' \'))\nsayi = []\nfor i in range(n):\n sayi.append(\'*\')\n\nfor i in range(m):\n s, t = map(int, input().split(\' \'))\n print(s, t)\n if s == 1 and t == 0:\n print(-1)\n break\n if sayi[s-1] == "*" or sayi[s-1] == str(t):\n sayi[s-1] = str(t)\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s049397152', 's888334567', 's898504931', 's443129378']
[3064.0, 3064.0, 3064.0, 3188.0]
[19.0, 18.0, 17.0, 19.0]
[492, 431, 415, 498]
p02761
u634079249
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 os\nimport math\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s176436818', 's276924799', 's400059367', 's449677732', 's528399523', 's742616737']
[3064.0, 3188.0, 3064.0, 3192.0, 3064.0, 3064.0]
[18.0, 19.0, 18.0, 18.0, 18.0, 19.0]
[865, 876, 811, 580, 898, 731]
p02761
u636251914
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 numpy as np\n\nN, M = [int(_) for _ in input().split()]\nS, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T\n\nprint("no")\n# ans = [-1] * N\n\n\n# j = int(S[i]) - 1\n# if ans[j] == -1 or ans[j] == C[i]:\n# ans[j] = C[i]\n# else:\n# print("-1")\n# ...
['Runtime Error', 'Accepted']
['s484015344', 's824370296']
[27052.0, 9132.0]
[116.0, 30.0]
[537, 431]
p02761
u638282348
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 = [None] * N\nfor _ in range(M):\n s, c = map(int, input().split())\n if ans[s - 1] in [None, c]:\n ans[s - 1] = c\n else:\n print(-1)\n quit()\n\nans = "".join(map(lambda i, n :str(n) if n else "0" if i else "1", enumerate(ans)))\nif N > 1 and ans[0...
['Runtime Error', 'Accepted']
['s557886522', 's295189885']
[3060.0, 3064.0]
[17.0, 17.0]
[354, 390]
p02761
u640603056
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)]\nans="-1"\ntmp=0\nfor i in range(0,1000):\n\ts = str(\'{:0=3}\'.format(i))\n\tfor j in range(M):\n\t\tif sc[j][0]==1 and sc[j][1] == 0:\n\t\t\tprint(-1)\n\t\t\texit()\n\t\tif s[len(s)-N+sc[j][0]-1]!=str(sc[j][1]):\n\t\t\tbreak\n...
['Wrong Answer', 'Accepted']
['s574962445', 's917336822']
[3064.0, 3064.0]
[19.0, 19.0]
[361, 371]
p02761
u640922335
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())\nINF=10**18\nA=[INF]*N\nans=0\nfor _ in range(M):\n s,c=map(int,input().split())\n s-=1\n if A[s]==INF:\n A[s]=c\n else:\n if A[s]!=c:\n print(-1)\n exit()\n else:\n continue\n\nif A[0]==0:\n print(-1)\n exit()\nelif ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s228760200', 's231046159', 's384490498', 's214384739']
[9224.0, 9200.0, 9232.0, 9216.0]
[29.0, 26.0, 27.0, 28.0]
[415, 499, 552, 645]
p02761
u641460756
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\ne = []\nfor i in range(m):\n si, ci = map(int, input().split())\n e += [[si, ci]]\n for j in range(len(e)):\n if e[j][0] == si and e[j][1] != ci:\n print(-1)\n exit()\n ans[si - 1] = ci\nif len(ans) == 1 and ans[0] == 0:\n pr...
['Runtime Error', 'Accepted']
['s264338464', 's647044498']
[3064.0, 3064.0]
[18.0, 18.0]
[535, 486]
p02761
u643679148
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 = []\nfor i in range(m):\n sc.append(tuple(map(int, input().split())))\n\n\nfor i in range(10**(n-1), 10**n):\n s = str(i)\n flag = True\n if len(s) == n and all([s[sc[j][0]-1] == str(sc[j][1]) for j in range(m))]:\n print(s)\n exit(0)\n\n\nprint('-1')\n\...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s048140960', 's151987647', 's977408402', 's657379117']
[8908.0, 9236.0, 9192.0, 9048.0]
[25.0, 27.0, 29.0, 28.0]
[775, 488, 775, 747]
p02761
u645487439
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 = ['X'] * n\n\ndef ans():\n return 0 if n == 1 and m == 0\n for i in range(m):\n set = list(map(str, input().split()))\n if set[0] == '1' and set[1] == '0' and n != 1:\n return -1\n else:\n if num_list[int(set[0]) - 1] == 'X':...
['Runtime Error', 'Accepted']
['s538728830', 's990969611']
[2940.0, 3064.0]
[17.0, 17.0]
[631, 640]
p02761
u646110634
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())\n\nnum = []\nfor i in range(N) :\n num.append([0])\n\nsc = []\nfor i in range(M) :\n sc.append(list(map(int, input().split()))) \n\nans = ""\n\nfor n in sc :\n if n[1] not in num[n[0]-1] :\n num[n[0]-1].append(n[1])\n\nif N >= and [1, 0] in sc :\n print(\'-1\')\n s...
['Runtime Error', 'Accepted']
['s945887857', 's718869546']
[2940.0, 3064.0]
[17.0, 19.0]
[547, 609]
p02761
u651109406
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 i in range(m):\n a, b = map(int, input().split())\n s.append(a), c.append(b)\n\nans = [0 for i in range(n)]\nb = 0\n\nfor i in range(m):\n if ans[s[i] - 1] == c[i]:\n ans[s[i] - 1] = c[i]\n else:\n print('-1')\n break\n\n if i ==...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s007863670', 's367766198', 's464931098', 's823616670', 's918108454', 's596188864']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 19.0, 18.0, 18.0, 17.0, 18.0]
[535, 440, 632, 441, 807, 392]
p02761
u652522621
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\nN = []\nFLAGS = True\nfor i in range(3):\n N1 = list(map(int, input().split(' ')))\n N.append(N1)\n\nN = np.array(N)\n\nM = int(input())\n\nfor i in range(M):\n a = int(input())\n \n for j in range(3):\n for k in range(3):\n if N[j, k] == a:\n N[j, k] = 0\n if (np.all(N == 0, ...
['Runtime Error', 'Accepted']
['s100461981', 's344759706']
[12504.0, 3192.0]
[153.0, 18.0]
[862, 622]
p02761
u652583512
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] = input().split()\n\nans = -1\nfor i in range(10 * (N - 1) + 1, 10 * N):\n for s, c in zip(S, C):\n if not str(i)[int(s) - 1] == c:\n break\n else:\n ans = i\n break\n if not ans...
['Runtime Error', 'Accepted']
['s208810912', 's320193247']
[3060.0, 3064.0]
[17.0, 17.0]
[324, 462]
p02761
u656391577
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\ninput = sys.stdin.readline\n\ndef main():\n\n N, M = map(int, input().split())\n Set = []\n for i in range(M):\n Set.append(list(map(int, input().split())))\n\n for i in range(10**N):\n num = str(i)\n if len(i) == N and all(num[s-1]==str(c) for s,c in Set):\n pr...
['Runtime Error', 'Accepted']
['s800414380', 's199852668']
[3064.0, 3064.0]
[18.0, 18.0]
[397, 372]
p02761
u658801777
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())\nr = list([None]*N)\nfor i in range(M):\n s, c = map(int, input().split())\n if r[s-1] is not None:\n print("-1")\n exit()\n r[s-1] = c\n\nif N > 1 and r[0] == 0:\n print("-1")\n exit()\n\nfor i in range(len(r)):\n if r[i] is None:\n if N...
['Wrong Answer', 'Accepted']
['s363971868', 's317604268']
[3064.0, 3064.0]
[18.0, 19.0]
[404, 420]
p02761
u658915215
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\nfor i in range(m):\n s, c = map(int,input().split())\n if s == 1 and c == 0 and n != 1:\n print(-1)\n break\n if ans[s-1] != '0' and c != ans[s-1]:\n print(-1)\n break\n ans[s-1] = c\nelse:\n if n == 1 and int(ans[0]) == 0:\...
['Runtime Error', 'Accepted']
['s878957609', 's490296732']
[9172.0, 9120.0]
[24.0, 34.0]
[429, 430]
p02761
u661439250
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_list = []\nfor i in range(n):\n n_list.append(0)\n\nfor i in range(m):\n s, c = map(int, input().split())\n n_list[s-1] = c\nans_list = map(str, n_list)\nans = ''.join(ans_list)\nprint(ans[::-1])", 'n,m = map(int, input().split()) \nsc = [list(map(int, input().split())) fo...
['Wrong Answer', 'Accepted']
['s211847417', 's363942341']
[3060.0, 2940.0]
[19.0, 18.0]
[230, 351]
p02761
u663710122
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\nres = ['x' for _ in range(N)]\n\nfor i in range(M):\n s, c = map(int, input().split())\n\n if s == 1 and c == 0:\n print(-1)\n exit()\n elif res[s-1] == 'x' or res[s-1] == str(c):\n res[s-1] = str(c)\n else:\n print(-1)\n exit()\n\nr =...
['Wrong Answer', 'Accepted']
['s327902098', 's904801112']
[3064.0, 3064.0]
[17.0, 18.0]
[348, 468]
p02761
u667084803
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_str = str(N)\nflag = 1\nkettei = [-1 for i in range(N)]\nfor i in range(M):\n s, c = map(int, input().split())\n if kettei[s-1] == -1:\n kettei[s-1] = c\n elif kettei[s-1] != c:\n flag = 0\nif kettei[0] == 0 :\n flag = 0\n \nans = ""\n\nfor i in range(N):\n if kettei[...
['Runtime Error', 'Runtime Error', 'Accepted']
['s049814055', 's423546468', 's611571062']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 18.0]
[395, 544, 541]
p02761
u669812251
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\nN, M = [int(i) for i in input().split()]\n\nS = []\nfor i in range(M):\n S.append([int(i) for i in input().split()])\n\nanswer = "0" * N\n\nfor s in S:\n if answer[int(s[0])-1] != s[1]:\n print(-1)\n else:\n answer = answer[:int(s[0])-1] + str(s[1]) + answer[int(s[0]...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s213696657', 's386987245', 's920428846']
[3188.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0]
[367, 634, 752]
p02761
u674052742
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"""\nCreated on Wed Mar 4 01:52:13 2020\n\n@author: Kanaru Sato\n"""\n\nN,M = list(map(int, input().split()))\nsc = []\n[sc.append(list(map(int, input().split()))) for i in range(0, M)]\n\nfound_flag = 0\n\nfor i in range(10**(N-1),10**N): \n str_num = str(i)\n flag_i = 0\n for j in...
['Wrong Answer', 'Accepted']
['s997198561', 's395487022']
[3064.0, 3188.0]
[18.0, 20.0]
[809, 783]
p02761
u674588203
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+1)\nfor i in range(M):\n s,c=map(int,input().split())\n if ans[s]==-1 :\n ans[s]=c\n elif ans[s]==c :\n pass\n else:\n print('-1')\n exit()\nif N>=2 and ans[1]==-1:\n print('-1')\n exit()\nelif N>=2 and ans[1]==0:\n print('-1')...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s268396058', 's348605363', 's376968624', 's398463033', 's640342064', 's784392894', 's894557928', 's971422462', 's091950862']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0, 3064.0]
[17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 19.0, 18.0]
[473, 476, 337, 594, 425, 425, 425, 425, 528]
p02761
u678167152
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\ndef solve():\n N, M = map(int, input().split())\n d = defaultdict(lambda: -1)\n for i in range(M):\n x,y = map(int, input().split())\n if d[x]>=0 and d[x]!=y:\n return -1\n if N>1 and x==1 and y==0:\n return -1\n d[x] = y\n if N==1 and d[1]==-1:\n retu...
['Wrong Answer', 'Accepted']
['s927307113', 's447504261']
[9472.0, 9404.0]
[31.0, 34.0]
[480, 480]
p02761
u680851063
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 _ in range(m)]\n\np = [[],[],[]]\nfor i in range(m):\n if l[i][0]== 1:\n p[0].append(l[i][1])\n elif l[i][0]== 2:\n p[1].append(l[i][1])\n else:\n p[2].append(l[i][1])\n\n#print(p)\n\nif len(p[0]) == 0:\n p[0...
['Runtime Error', 'Accepted']
['s056326699', 's984543470']
[3064.0, 3064.0]
[18.0, 18.0]
[825, 354]
p02761
u687135117
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\n\n\nn,m= map(int, input().split())\n#print(n,m)\n\nA=[]\nfor i in range(0,m):\n input_1= list(map(int, input().split()))\n A.append(input_1)\n#print(A)\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\n\n\nB=get_unique_list(A)\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s190815632', 's734438062', 's435145754']
[12436.0, 3064.0, 3192.0]
[151.0, 18.0, 18.0]
[953, 466, 1589]
p02761
u688219499
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()]\n\nA = []\nanswer=[0]*M\nfor i in range(M):\n A.append(list(map(int,input().split())))\nj=0\nfor i in range(M):\n if answer[int(A[i][0])-1] == 0:\n answer[int(A[i][0])-1] = int(A[i][1])\n elif answer[int(A[i][0])-1] == int(A[i][1]):\n answer[int(A[i][0])-1...
['Runtime Error', 'Accepted']
['s790437377', 's442052824']
[3064.0, 3060.0]
[17.0, 19.0]
[559, 241]
p02761
u688375653
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 input_int():\n return map(int, input().split())\n\ndef one_int():\n return int(input())\n\ndef one_str():\n return input()\n\ndef many_int():\n return list(map(int, input().split()))\n\nN,M = input_int()\n\ndata = []\nfor i in range(M):\n s,c = input_int()\n data.append([s,c])\n\noutput = [0 for...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s942725388', 's958123061', 's530422541']
[3064.0, 3188.0, 3064.0]
[17.0, 19.0, 19.0]
[659, 692, 658]
p02761
u692453235
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+1)\nFlag = True\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 ans[s-1] == c:\n continue\n else:\n Flag = False\n\nif N > 1:\n if ans[0] == 0:\n Flag = False\n elif ans[0] == -1:\n ans[0] = 1\n ...
['Runtime Error', 'Accepted']
['s414747195', 's668341967']
[3064.0, 3064.0]
[17.0, 17.0]
[488, 372]
p02761
u692515710
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\nN, M = map(int, input().split())\nNUMS = [list(map(int, input().split())) for _ in range(M)]\n\n\ndef solve():\n if M == 0:\n print("-1")\n return\n\n for n in range(10 ** (N - 1), 10 ** (N)):\n res = 0\n for s, c in NUMS:\n if str(n)[s - 1] == str...
['Wrong Answer', 'Accepted']
['s020197812', 's043433307']
[3064.0, 3060.0]
[18.0, 18.0]
[432, 410]
p02761
u692691139
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 pysnooper\n#import numpy\n\n#from collections import Counter,deque\n#from operator import itemgetter,mul\n#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations\nfrom sys import stdin,setrecursionlimit\n\n#from copy import deepcopy\n#import heapq\n#import math\n#impo...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s585129010', 's733460877', 's300613563']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 19.0]
[914, 924, 934]
p02761
u692746605
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=[-1 for _ in range(N)]\nfor m in range(M):\n s,c=map(int,input().split())\n if d[s-1]==-1:\n d[s-1]=c\n elif d[s-1]!=c:\n print(-1)\n exit()\n\nif N>1:\n\tif d[0]==0:\n print(-1)\n exit()\n elif d[0]==-1:\n \td[0]=1\n\nA=0\nfor i in range(N):\n A=A*10+(d[i] if d[i]...
['Runtime Error', 'Accepted']
['s809262058', 's092173844']
[2940.0, 3064.0]
[18.0, 17.0]
[320, 321]
p02761
u695261159
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 x in range(m)]\n\nans = ['0']*(n+1)\nans[1] = '1'\nflg = 0\nfor i in range(m):\n print(sc[i][1])\n if ans[sc[i][0]] == '0' or int(ans[sc[i][0]]) >= sc[i][1]:\n if sc[i][1] != 0 and flg == 0:\n ans[sc[i][0]] = str(sc[i][1]...
['Wrong Answer', 'Accepted']
['s820489337', 's276505771']
[3064.0, 3064.0]
[18.0, 18.0]
[476, 705]
p02761
u697386253
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 i in range(m)]\n\ncount = float('inf')\nif n == 3:\n for i in range(100, 1000):\n a = str(i)\n if all(int(a[s[j][0]-1]) == int(s[j][1]) for j in range(m)):\n if i < count:\n count = i\nelif n == 2:\n ...
['Runtime Error', 'Accepted']
['s006431216', 's066808843']
[3064.0, 3188.0]
[17.0, 21.0]
[712, 719]
p02761
u697559326
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 = []\nfor _ in range(M):\n sc.append(list(map(int, input().split())))\n\nketa = [-1]*N\nflag = 0\nfor i in range(M):\n for j in range(1,N+1):\n print(i,j,sc[i][0], keta)\n if sc[i][0] == j:\n if keta[j-1] == -1:\n keta[j-1] = sc[i][1]\...
['Wrong Answer', 'Accepted']
['s672650514', 's294541500']
[3064.0, 3064.0]
[18.0, 17.0]
[1078, 1079]
p02761
u698849142
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 = [None]*n\nmsg=''\nfor _ in range(m):\n s, c = input().split()\n index = int(s)-1\n if l[index] is None:\n l[index] = c\n else:\n if l[index] == c:\n continue\n else:\n msg=-1\n break\nl = list(map(lambda x: '0' if x i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s402460581', 's881413704', 's113079669']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[427, 360, 476]
p02761
u699089116
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)]\nsc = list(map(list, set(map(tuple, sc))))\n\nl = list()\nfor i in range(1000):\n i = str(i)\n flg = True\n for j in sc:\n if i[j[0]-1] != j[1]:\n flg = False\n if flg:\n l.append(int(i))\n\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s648629808', 's923075261', 's731004223']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0]
[318, 313, 681]
p02761
u703442202
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_list = []\nfor i in range(m):\n s_c_list.append(list(map(int,input().split())))\ncheck = False\n\nfor i in range(10**n-1,10**n):\n counter = 0\n list_i = list(str(i))\n for j in range(m):\n if list_i[s_c_list[j][0] - 1] == s_c_list[j][1]:\n counter += 1\n if counter ==...
['Wrong Answer', 'Accepted']
['s826956180', 's775266428']
[3064.0, 3064.0]
[17.0, 20.0]
[369, 749]
p02761
u703823201
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())\n\nif N == 1:\n sc = []\n for m in range(M):\n s, c = map(int, input().split())\n sc.append(c)\n sc = set(sc)\n if len(sc) == 0:\n print(0)\n sys.exit(0)\n elif len(sc) == 1:\n print(sc[0])\n sys.exit(0)\n else:\n...
['Runtime Error', 'Accepted']
['s631291055', 's242680972']
[3192.0, 3064.0]
[18.0, 18.0]
[1961, 316]
p02761
u704284486
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 for _ in range(N)]\nfor i in range(M):\n s,c = map(int,input().split(" "))\n if ans[s-1] != -1 and ans[s-1] != c:\n print(-1)\n exit()\n else:\n ans[s-1] = c\nif ans[0] == 0:\n print(-1)\n exit() \nfor i in range(N):\n if ans[i] == -...
['Runtime Error', 'Accepted']
['s346247068', 's580022463']
[3064.0, 3064.0]
[17.0, 19.0]
[443, 593]
p02761
u707712609
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 = []\nc = []\nfor _ in range(M):\n tmp1, tmp2 = map(int, input().split())\n s.append(tmp1-1)\n c.append(tmp2)\n\ndigit = [-1, -1, -1]\n\nfor i in range(M):\n if digit[s[i]] < 0:\n digit[s[i]] = c[i]\n else:\n print("-1")\n exit()\n\nif (N == 1) and (digit[0] == 0):\...
['Wrong Answer', 'Accepted']
['s787627132', 's996991201']
[3064.0, 3064.0]
[17.0, 18.0]
[522, 658]
p02761
u710659690
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()))\nB = {}\nfor i in range(M):\n k, v = input().split()\n if (k in B) and (B.get(k)!=v):\n print(-1)\n exit()\n else:\n B[k] = v\nif (N!=1) and (B.get("1", "0")=="0"):\n print(-1)\n exit()\nans = B.get("1", "1")\nfor i in range(2, N+1):\n ans = ans + str(B.get(i, 0))...
['Wrong Answer', 'Accepted']
['s125003520', 's573263517']
[3064.0, 3064.0]
[18.0, 17.0]
[315, 363]
p02761
u711693740
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'] * N\nnum[0] = '1'\nerror = False\n\nfor i in range(M):\n s, c = input().split()\n if num[int(s)-1] in ['0', c]:\n num[int(s)-1] = c\n else:\n error = True\n break\n\nif num[0] == '0' or error:\n print(-1)\nelse:\n print(''.join(num))\n"...
['Wrong Answer', 'Accepted']
['s876549867', 's110776924']
[3060.0, 3064.0]
[18.0, 17.0]
[300, 440]
p02761
u716043626
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\nnum = [-1]*n\n\nans = True\n\nfor i in range(m):\n if num[sc[i][0]-1] == -1:\n num[sc[i][0]-1] = sc[i][1]\n elif num[sc[i][0]-1] == sc[i][1]:\n continue\n else:\n ans = False\n \nif num[0] ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s125948944', 's204129903', 's276514580', 's376419285', 's606363533', 's986335503', 's315170412']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 18.0, 18.0, 18.0, 18.0, 17.0, 18.0]
[690, 547, 473, 523, 475, 492, 333]