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 | u381877079 | 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\nv=[0]*n\nf=0\nfor _ in range(m):\n\ts,c=map(int,input().split())\n\tif(v[s-1]==0 or a[s-1]==c):\n\t\tv[s-1]=1\n\t\ta[s-1]=c\n\telse:\n\t\tf=1\ns1='a'\nif n!=1 and a[0]==-1:\n\ta[0]=1\nfor x in a:\n\ts1+=str(x)\nif f==1 or (n!=1 and s1[1]=='0'):\n\tprint(-1)\nelse:\n\tprint(s1[1... | ['Wrong Answer', 'Accepted'] | ['s857057800', 's154636596'] | [3064.0, 3064.0] | [17.0, 17.0] | [290, 307] |
p02761 | u382407432 | 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(" "))\ng=[]\nt=[]\nsac=0\nfor i in range(n):\n g.append("0")\n t.append("")\nfor j in range(m):\n s,c=map(int,input().split(" "))\n if(g[s-1]!=str(c) and t[s-1]==""):\n g[s-1]=str(c)\n t[s-1]="T"\n if(g[s-1]!=str(c) and t[s-1]!=""):\n sac=1\n if(s==1 and c==0):\n sac=1\nif(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s381780181', 's485188809', 's602344092'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [482, 499, 504] |
p02761 | u382639013 | 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 _ in range(M)]\n\nb = [0]*N\n\nans = 0\nfor i in range(M):\n if b[A[i][0]-1] ==0:\n b[A[i][0]-1] = A[i][1]\n elif b[A[i][0]-1] == A[i][1]:\n pass\n else:\n ans = -1\n break\n\ns = ''.join([str(N) for N in b])... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s033444097', 's880784461', 's826500023'] | [3064.0, 3064.0, 3060.0] | [18.0, 18.0, 18.0] | [428, 368, 241] |
p02761 | u383450070 | 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)\n C.append(b)\nfor j in range(10**n):\n if len(j)==n and all(str(j)[x-1]==str(y) for x,y in zip(S,C)):\n print(j)\n break;\nelse:\n print(-1)', 'n,m=map(int,input().split())\nS,C=[], []\nfor i in range... | ['Runtime Error', 'Accepted'] | ['s222773700', 's027898527'] | [3064.0, 3064.0] | [25.0, 18.0] | [247, 252] |
p02761 | u386944085 | 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=-1\nd=0\nf=0\ng=0\nN, M = map(int, input().split())\nlist = []\nfor i in range(M):\n a,b=input().split()\n list.append((int(a), int(b)))\n\nfor i in range(M):\n\t\n\tif list[i][0]>N or (list[i][0]+list[i][1]==1 and N!=1):\n\t\tprint(c)\n\t\tf=1\n\t\tbreak\n\tfor j in range(i+1,M):\n\t\tif list[i][0]==list[j][... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s731479449', 's821304574', 's435931669'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 19.0] | [516, 444, 489] |
p02761 | u389910364 | 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 bisect\nimport cmath\nimport heapq\nimport itertools\nimport math\nimport operator\nimport os\nimport random\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_c... | ['Wrong Answer', 'Accepted'] | ['s488527547', 's511175239'] | [15652.0, 3064.0] | [224.0, 18.0] | [951, 603] |
p02761 | u391675400 | 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 i in range(M)]\n\nif N==1:\n r = range(10)\nelif N==2:\n r = range(10,100)\nelse:\n r = range(100,1000)\nfor n in r:\n print(n)\n n = str(n)\n for s,c in SC:\n #print("s=",s,"c",c)\n if n[s-1] != str(c):\n ... | ['Wrong Answer', 'Accepted'] | ['s744046522', 's670869844'] | [3188.0, 3064.0] | [20.0, 18.0] | [365, 366] |
p02761 | u392441504 | 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 = [map(int, input().split()) for _ in range(m)]\ns, c = [list(i) for i in zip(*sc)]\n\n\n\nfor i in range(10**n):\n ans = str(i)\n if len(i) == n and all([i[s[j]-1] == str(c[j]) for j in range(m)]):\n print(ans)\n exit()\n\n\nprint(-1)', 'n,m = map(int, input().... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s298699771', 's817486307', 's441677921'] | [9196.0, 9080.0, 8956.0] | [22.0, 21.0, 35.0] | [278, 275, 609] |
p02761 | u395202850 | 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())\ns = list(input())\nq = int(input())\n\nfor _ in range(q):\n a1, a2, a3 = input().split()\n\n \n if a1 == "1" and s[int(a2) - 1] != a3:\n s[int(a2) - 1] = a3\n\n \n else:\n print(len(set(s[int(a2) - 1:int(a3)])))\n', 'n = int(input())\ns = list(input())\nq = int(input())\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s305886246', 's814176754', 's175532389'] | [2940.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0] | [274, 286, 516] |
p02761 | u396518935 | 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())\nrslt = [-1]*N\nfor m in range(M):\n s, c = map(int, input().split())\n if s == 1 and c == 0:\n print(-1)\n exit()\n elif s >= N:\n print(-1)\n exit()\n elif rslt[s-1] != -1 and rslt[s-1] != c:\n print(-1)\n exit()\n else:\n rslt[s-1] = c\n\nif rslt[0] == -1:... | ['Wrong Answer', 'Accepted'] | ['s759666433', 's178073973'] | [3064.0, 3064.0] | [18.0, 17.0] | [422, 403] |
p02761 | u396553339 | 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\nlistans = [0] * n\nans = 0\n\nfor i in range(m):\n s, c = map(int, input().split())\n if s == 1 and c == 0:\n ans = -1\n if listans[int(s)-1] != c:\n if listans[int(s)-1] == "0":\n listans[int(s)-1] = c\n else :\n ans = -1\n\nif a... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s165688728', 's198438811', 's534525552', 's696826869', 's983208263'] | [3064.0, 3188.0, 3064.0, 3064.0, 3064.0] | [17.0, 19.0, 18.0, 17.0, 17.0] | [436, 437, 343, 436, 393] |
p02761 | u397496203 | 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\n\ndef main():\n N, M = map(int, input().split())\n S = [list(map(int, input().split())) for _ in range(M)]\n ans = [0 for _ in range(N)]\n if N > 1:\n ans[0] = 1\n for i, s in enumerate(S):\n if s[0] == 1 and s[1] == 0:\n if N > 1:\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s745975928', 's931670770', 's553646189'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [730, 661, 730] |
p02761 | u398355880 | 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=[]\ns=[]\nc=[]\nans=0\nfor i in range(n):\n a.append(0)\nfor j in range(m):\n s,c= map(int,input().split())\n if a[s-1]==0 & a[s-1]==c:\n #print(str(j)+"e")\n a[s-1]=c\n else:\n ans=-1\nif a[0]==0:\n ans=-1\nif ans!=-1:\n ans=0\n for k in range(n):\n ans+=a[k]*(10*... | ['Wrong Answer', 'Accepted'] | ['s804114087', 's107100485'] | [3064.0, 3064.0] | [18.0, 19.0] | [319, 367] |
p02761 | u402629484 | 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\nsys.setrecursionlimit(1000000000)\nimport math\nfrom fractions import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis = lambda: m... | ['Wrong Answer', 'Accepted'] | ['s928674517', 's758301175'] | [5812.0, 3064.0] | [56.0, 18.0] | [1472, 354] |
p02761 | u405256066 | 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\nN,M = [int(x) for x in stdin.readline().rstrip().split()]\ndata = []\nS = []\nfor i in range(M):\n s,c = [int(x) for x in stdin.readline().rstrip().split()]\n S.append(s)\n data.append((s,c))\nans = ["1"]+["0"]*(N-1)\n \nfor i,j in sorted(data)[::-1]:\n ans[i-1] = str(j)\n\nif len(S... | ['Wrong Answer', 'Accepted'] | ['s947767311', 's775272956'] | [3064.0, 3064.0] | [17.0, 18.0] | [661, 696] |
p02761 | u408375121 | 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:\n if N == 1:\n print(0)\n else:\n m = 10 ** (N - 1)\n print(m)\nelse:\n dic = {}\n t = ''\n for _ in range(M):\n s, c = map(int, input().split())\n if s not in dic:\n dic[s] = c\n else:\n print(-1)\n break\n if 1 in dic:\n if dic[1... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s030778080', 's714901775', 's874872914', 's894365888', 's900923557', 's265763928'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [463, 712, 588, 464, 634, 686] |
p02761 | u408620326 | 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\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nN, M = [int(x) for x in input().strip().split()]\nD = [-1] * N\n\nfor m in range(M):\n s, c = [int(x) for x in input().strip().split()]\n if D[s-1] == -1:\n D[s-1] = c\n continue\n if D[s-1] == c:\n continue\n pri... | ['Wrong Answer', 'Accepted'] | ['s004641261', 's686020229'] | [3064.0, 3064.0] | [17.0, 17.0] | [531, 620] |
p02761 | u409542115 | 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... | ['\nN,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.append(b)\n\nokflag = True\n\nfor i in range(M):\n\n if not okflag:\n break\n for j in range(M):\n if not okflag:\n break\n if not (i==j):\n\n if s[i]==s[j] ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s147896856', 's151455163', 's212192421', 's266110782', 's755916357', 's847042910', 's992019855', 's560949732'] | [3064.0, 3188.0, 3188.0, 3064.0, 3188.0, 3188.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0, 18.0, 19.0, 18.0, 18.0, 18.0] | [573, 437, 426, 1906, 422, 427, 440, 592] |
p02761 | u410118019 | 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 = [-1] * n\nfor i in range(m):\n s,c = map(int,input().split())\n if n != 1 and [s,c] == [1,0]:\n print(-1)\n exit()\n if l[s-1] == -1 or l[s-1] == c:\n l[s-1] = c\n else:\n print(-1)\n exit()\nif l[0] == -1 and n != 1:\n l[0] = 1\nelse:\n l[0] = 0\nprint(*[i if ... | ['Wrong Answer', 'Accepted'] | ['s422997338', 's738276907'] | [3064.0, 3064.0] | [18.0, 18.0] | [336, 347] |
p02761 | u411302151 | 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 = [None] * N\nflag = 1\nfor i in range(M):\n s,c = map(int,input().split())\n\n if (c == 0 and s < N) or ans[s-1]:\n flag = 0\n print(-1)\n break\n ans[s-1] = c\n\nfor i in range(N):\n if not ans[i]:\n ans[i] = 0\n\nif flag:\n print("".... | ['Wrong Answer', 'Accepted'] | ['s250599319', 's223301030'] | [3064.0, 3064.0] | [17.0, 18.0] | [330, 1087] |
p02761 | u411858517 | 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())\nq = [list(map(int, input().split())) for i in range(M)]\nchange = [0 for i in range(N)]\n\nans = list('0' * N)\nfor i in range(M):\n if change[q[i][0]-1] == 0:\n \tans[q[i][0] - 1] = q[i][1]\n \tchange[q[i][0]-1] = 1\n else:\n if ans[q[i][0] - 1] != q[i][1]:\n ans = -1\n ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s040892040', 's143497397', 's225599367', 's225775816', 's487398463', 's536709289', 's790086637', 's816066740', 's948646952', 's185293192'] | [3064.0, 3064.0, 2940.0, 3064.0, 3064.0, 3060.0, 3060.0, 3060.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 19.0, 18.0, 19.0, 17.0, 19.0] | [422, 303, 366, 365, 343, 346, 360, 360, 370, 387] |
p02761 | u415716267 | 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... | ['NM = list(map(int,input().split()))\nN = NM[0]\nM = NM[1]\nSC = []\ntemp = [0] * N\ntemp2 = [True] * 9\ntest = True\ntest2 = True\nfor i in range(M):\n SC.append(list(map(int,input().split())))\n Ldigit = SC[i][0]\n Lnum = SC[i][1]\n if temp2[Ldigit-1]:\n temp[Ldigit-1] = Lnum\n temp2[Ldigit... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s089744552', 's119687345', 's130811734', 's668698196'] | [3064.0, 3064.0, 3188.0, 3064.0] | [17.0, 18.0, 18.0, 17.0] | [579, 382, 566, 745] |
p02761 | u418502493 | 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()))\nconsumed = {}\nfor i in range(M):\n s,c = list(map(int, input().split()))\n\n if s == 1 and c == 0 and N != 1:\n print(-1)\n exit()\n\n if s in consumed:\n if consumed[s] != c:\n print(-1)\n exit()\n\n consumed[s] = c\n\npri... | ['Wrong Answer', 'Accepted'] | ['s732549652', 's264137871'] | [3064.0, 3064.0] | [17.0, 17.0] | [367, 486] |
p02761 | u419963262 | 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" for i in range(N)]\nseen=[]\nfor i in range(M):\n A=input().split()\n if A not in seen:\n seen.append(A)\n if S[int(A[0])-1]=="0":\n S[int(A[0])-1]=A[1]\n else:\n W="bad"\nANS="".join(S)\nif (ANS[0]=="0" and len(ANS)!=1) or W=="bad"... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s153567089', 's482722797', 's445411571'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0] | [344, 673, 663] |
p02761 | u422165425 | 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\nar = []\nx = sys.stdin.readline()\nx = x.split(\' \')\n(n,m)=[int(str) for str in x]\n\nret = 0\nchk = []\nfor i in range(m):\n x = sys.stdin.readline()\n x = x.split(\' \')\n (s,c)=[int(str) for str in x]\n if not ( s in chk):\n if(n-s>0):\n ret += c*10**(n-s)\n chk.append(s)\nif( ret ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s162205154', 's174963390', 's208440587'] | [3064.0, 3064.0, 3064.0] | [19.0, 18.0, 17.0] | [412, 538, 545] |
p02761 | u422886513 | 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)\n\nif M==0:\n print(0)\n exit()\n\ns = []\nc = []\n\none_list = []\ntwo_list = []\nthree_list = []\n\nfor i in range(M):\n tmp_s, tmp_c = input().split(" ")\n tmp_s = int(tmp_s)\n tmp_c = int(tmp_c)\n s.append(tmp_s)\n c.append(tmp_c)\n if tmp_... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s374361841', 's493017441', 's736561415', 's085223930'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 18.0, 17.0] | [879, 940, 1039, 947] |
p02761 | u427163848 | 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 = []\nt_1 = []\nt_2 = []\nfor i in range(M):\n t_1,t_2 = map(int, input().split())\n s.append(t_1)\n c.append(t_2) \n\nprint(\'s={0},c={1}\'.format(s,c))\n\nans = []\nfor p in range(N):\n ans.append(-1)\nfor j in range(M):\n ans[s[j]-1:s[j]] = [c[j]]\nfor k i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s807282734', 's868788292', 's300729982'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [415, 415, 623] |
p02761 | u428199834 | 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>=1:\n s=[0]*M\n c=[0]*M\n for i in range(M):\n s[i],c[i]=map(int,input().split())\n\n a=0\n for i in range(M-1):\n for j in range(i+1,M):\n if s[i]==s[j] and c[i]!=c[j]:\n a+=1\n if a==0:\n u_=[0,0,0]\n for i in range(M):\n ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s136499592', 's316637599', 's968342937', 's501706120'] | [3064.0, 3064.0, 3188.0, 3064.0] | [17.0, 18.0, 20.0, 17.0] | [916, 599, 581, 905] |
p02761 | u431573188 | 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\ncond = list(list(map(int, input().split())) for i in range(m))\n\nnum = [0]*n\nif len(num) != 1:\n num[0] = 1\n\nfor i in range(m):\n digit = cond[i][0] - 1\n a = cond[i][1]\n if num[digit] == 0 or num[digit] == a:\n num[digit] = a\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s244793432', 's759214683'] | [3064.0, 3064.0] | [18.0, 17.0] | [504, 562] |
p02761 | u432853936 | 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)]\ntmp = [-1]*n\nfor j in range(m):\n if tmp[(sc[j][0]-1)] != sc[j][1]:\n if tmp[(sc[j][0]-1)] != -1:\n print(-1)\n exit()\n tmp[(sc[j][0]-1)] = sc... | ['Wrong Answer', 'Accepted'] | ['s858390683', 's747170848'] | [3064.0, 3064.0] | [18.0, 17.0] | [549, 727] |
p02761 | u433371341 | 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 = tuple(int(n) for n in input().split())\n\nstr_list = ['0' for n in range(N)]\nstr_state = [0 for n in range(N)] \n\n#print(str_list)\n#print(str_state)\n\nfor i in range(M):\n si, ci = tuple(int(n) for n in input().split())\n print('si: %d, ci: %d' % (si, ci))\n ci = str(ci)\n if str_... | ['Wrong Answer', 'Accepted'] | ['s554305410', 's067713010'] | [3064.0, 3064.0] | [17.0, 18.0] | [816, 870] |
p02761 | u436982376 | 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 = []\n\nfor i in range(m):\n s, c = map(int,input().split())\n n_list.append([s, c])\n\nn_list = list(tuple(sorted(n_list)))\n\nketa = [-1 for i in range(n)]\nflag = 0\n\nfor i in range(len(n_list)):\n if keta[n_list[i][0]-1] == -1:\n keta[n_list[i][0]-1] = n_li... | ['Wrong Answer', 'Accepted'] | ['s744609477', 's714913549'] | [3064.0, 3064.0] | [18.0, 18.0] | [993, 993] |
p02761 | u437351386 | 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()))\nans=[-1 for i in range(n)]\n\nfor i in range(m):\n s,c=list(map(int,input().split()))\n if n!=1 and s==1 and c==0:\n print(-1)\n sys.exit()\n if ans[s-1]==-1 or ans[s-1]==c:\n ans[s-1]=c\n else:\n print(-1)\n sys.exit()\n\n \nif n==1 and ans[0]==0\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s247708066', 's448752958', 's479563723', 's766824285', 's677104284'] | [3060.0, 3060.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 17.0] | [460, 452, 462, 450, 461] |
p02761 | u439176910 | 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())\narr = []\nans = [0] * N\nans[0] = 1\nfor i in range(M):\n s, c = map(int, input().split())\n print(s, c)\n if s == 1 and c == 0 and N != 1:\n print(-1)\n exit(0)\n if s in arr and ans[s-1] != c:\n print(-1)\n exit(0)\n arr.append(s)\n ans... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s435898102', 's782646010', 's898765442', 's186295282'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 19.0, 18.0, 17.0] | [352, 356, 341, 350] |
p02761 | u439619952 | 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 solve():\n N,M = [int(i) for i in input().split()]\n digits = [\'0\'] * N\n targets = set([])\n for i in range(M):\n s,c = [int(num) for num in input().split()]\n target = s - 1\n if target == 0 and c == 0:\n digits = [\'-1\']\n break\n if target in ta... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s452098427', 's947124679', 's885863757'] | [9176.0, 9208.0, 9148.0] | [33.0, 27.0, 29.0] | [499, 519, 578] |
p02761 | u440129511 | 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)]\nn1=[0]*n\nnc=[0]*n\nfor i in range(n):\n if n1[x[i][0]-1]==0:\n n1[x[i][0]-1]+=x[i][1]\n nc[x[i][0]-1]+=1\n elif nc[x[i][0]-1]!=0 and n1[x[i][0]-1]!=x[i][1]:\n print(-1)\n exit()\nwhile True:\n if... | ['Runtime Error', 'Accepted'] | ['s130039400', 's422370070'] | [3064.0, 3064.0] | [17.0, 17.0] | [419, 282] |
p02761 | u440161695 | 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\nN,M=map(int,input().split())\nd={}\nfor i in range(M):\n a,b=map(int,input().split())\n if a==1 and b==0 and N>1:\n print(-1)\n sys.exit()\n if not a in d:\n d[a]=b\n elif d[a]!=b:\n print(-1)\n sys.exit()\nA=[0]*N\nfor i in d:\n A[i-1]=d[i]\n... | ['Wrong Answer', 'Accepted'] | ['s148474528', 's583161166'] | [2940.0, 3064.0] | [17.0, 18.0] | [9, 377] |
p02761 | u441599836 | 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-1)\n c.append(C)\n\nans = [9] * n\n\nused = []\nfor i in range(m):\n if s[i] not in used:\n ans[s[i]] = c[i]\n used.append(s[i])\n else:\n if ans[s[i]] != c[i]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s480602888', 's559278107', 's898875207', 's911099356', 's980316373', 's867706668'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0, 17.0, 18.0, 18.0] | [551, 470, 568, 504, 518, 411] |
p02761 | u442877951 | 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 = [map(int,input()) for i in range(M)]\nl = []\nfirst = []\nsecond = []\nthird = []\nfor i in range(M):\n if s[i] == 1:\n first.append(c[i])\n elif s[i] == 2:\n second.append(c[i])\n elif s[i] == 3:\n third.append(c[i])\nif first == []:\n print(-1)\nelif second == []:\... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s266046877', 's274203669', 's378404062', 's465367032', 's489065307', 's944333047', 's052888155'] | [3064.0, 3188.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [19.0, 18.0, 17.0, 17.0, 17.0, 18.0, 19.0] | [461, 585, 485, 471, 504, 494, 286] |
p02761 | u450904670 | 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 fuga(check_dict, check_str):\n for j, num_str in enumerate(str(check_str)):\n if(not(j in check_dict)):\n continue\n if(check_dict[j] != int(num_str)):\n return False\n return True\n\nN,M = list(map(int, input().split()))\nli = [list(map(int, input().split())) for _ in range(M)]\ncheck = {}\nfor... | ['Wrong Answer', 'Accepted'] | ['s715401245', 's297993151'] | [3064.0, 3064.0] | [18.0, 18.0] | [623, 610] |
p02761 | u452269253 | 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()]\nvalid = True\nans = [-1]*N\nfor a in range(M):\n s,c = [int(i) for i in input().split()]\n if ans[s-1] == -1:\n ans[s-1] = c\n else:\n valid = False\n\nfor a in range(len(ans)):\n if ans[a] == -1:\n ans[a] = 0\nif valid:\n n = "".join(map(s... | ['Wrong Answer', 'Accepted'] | ['s021128562', 's084837544'] | [3064.0, 3064.0] | [17.0, 17.0] | [419, 572] |
p02761 | u453623947 | 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 = [-1] * N\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 t[s-1] = c\n\nif N != 1 :\n if ans[0] == 0 :\n print(-1)\n exit()\n if ans[0] == -1 :\n ans[0] = 1\n ... | ['Runtime Error', 'Accepted'] | ['s940654691', 's685163194'] | [9076.0, 9160.0] | [27.0, 30.0] | [439, 441] |
p02761 | u455408345 | 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... | ['nm=input("").split(" ")\nn=int(nm[0])\nm=int(nm[1])\nlists=[-1]*n\nss=0\nfor i in range(m):\n sc=input("").split(" ")\n s=int(sc[0])\n c=int(sc[1])\n if(s==1 and c==0):\n ss=1\n elif(lists[s-1]==-1):\n lists[s-1]=c\n elif(lists[s-1]==c):\n None\n else:\n ss=1\nif(ss==1... | ['Wrong Answer', 'Accepted'] | ['s963321674', 's491620756'] | [9148.0, 9220.0] | [28.0, 30.0] | [476, 997] |
p02761 | u460229551 | 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]+[0]*(n-1)\ncheck=0\n\nfor _ in range(m):\n s,c=list(map(int,input().split()))\n s-=1\n if s==0:\n if c==0:\n check+=1\n break\n elif ans[s]!=1:\n check+=1\n break\n else:\n ans[s]=c\n el... | ['Wrong Answer', 'Accepted'] | ['s851907958', 's191374008'] | [3064.0, 3064.0] | [17.0, 17.0] | [484, 945] |
p02761 | u460375306 | 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 assignment already exists for a digit, check it is consistent.\n# no leading zeroes (except for the number zero)\n# given constraints are ok, fill other digits with zeros (and potentially 1 for lead)\n\ndef assign_digits(ans):\n flags_assigned = [0]*N\n for _ in range(M):\n new_s = int(s.pop())\n new_c =... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s323617701', 's808902837', 's850772382'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [830, 820, 843] |
p02761 | u460737328 | 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 = map(int, input().split())\nsc = defaultdict(list)\n\nfor i in range(M):\n s, c = map(int, input().split())\n sc[s].append(c)\n\nans = [-1] * N\nres = True\nfor s, c in sc.items():\n if len(set(c)) != 1:\n res = False\n break\n else:\n ans[s ... | ['Wrong Answer', 'Accepted'] | ['s761114596', 's019724872'] | [3316.0, 3316.0] | [20.0, 21.0] | [625, 578] |
p02761 | u461833298 | 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 = [[int(x) for x in input().split()] for _ in range(M)]\n\nans = [0] * N\nflg = 0\n\nfor s, c in SC:\n if (flg>>(s-1))&1:\n ans=[-1]\n break\n else:\n flg |= 1<<(s-1)\n ans[s-1] = c\n\n\nans = ''.join(map(str, ans))\nans = str(int(ans))\n\nif len(... | ['Wrong Answer', 'Accepted'] | ['s866756648', 's018256237'] | [3064.0, 3064.0] | [17.0, 18.0] | [343, 407] |
p02761 | u469281291 | 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())\nisExist=True\nli2 = [[''] for i in range(n)]\nfor i in range(m):\n s, c = map(int, input().split())\n if (li2[s - 1][0] != '' and li2[s - 1][0] != c):\n isExist = False\n elif(s == 1 and c == 0):\n isExist = False\n else:\n li2[s - 1][... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s367746052', 's430640529', 's167884220'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [629, 625, 719] |
p02761 | u469953228 | 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# a,b,c=map(int,input().split())\n# s=input()\n# s,t=map(str,input().split())\nans=[0]*n\nanss=""\nl=[]\nL=[]\nfor i in range(m):\n s,c=map(int,input().split())\n l.append(str(s)+str(c))\n\nl=list(set(l))\nfor x in l:\n L.append([x[0],x[1]])\nX=[]\n\nfor i in range(len(L)):\n\n ans[i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s616700558', 's618731855', 's685993639'] | [3064.0, 3192.0, 3064.0] | [17.0, 18.0, 17.0] | [584, 629, 472] |
p02761 | u470560351 | 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 = [-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 continue\n else:\n ans = -1\n break\n\nif ans == -1:\n print(ans)\nelif ans[0] ==0:\n print(-1)\nelse:\n answer = ''\n for i in ra... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s329704131', 's570298133', 's257355507'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [388, 389, 523] |
p02761 | u471641802 | 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 = tuple(set(tuple(map(int, input().split())) for _ in range(m)))\n\nans = 0\nfor sc in s_c:\n if (sc[0] == 1 and sc[1] == 0) or sc[0] > n:\n print('-1')\n exit()\n \n for s in s_c:\n if s[0] == sc[0] and s[1] != sc[1]:\n print('-1')\n ... | ['Wrong Answer', 'Accepted'] | ['s198912023', 's675324088'] | [3064.0, 3064.0] | [18.0, 18.0] | [420, 434] |
p02761 | u472197237 | 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 che(x):\n if x == -1:\n return 0\n return x\n\n\ndef main():\n N, M = map(int, input().split(' '))\n result = [-1 for _ in range(N)]\n flag = True\n for _ in range(M):\n a, b = map(int, input().split(' '))\n a = a - 1\n if result[a] != -1 or (a == 0 and b == 0):\n ... | ['Wrong Answer', 'Accepted'] | ['s988284260', 's190417159'] | [3064.0, 3064.0] | [18.0, 17.0] | [579, 484] |
p02761 | u474423089 | 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 = [[] for i in range(N)]\nfor i in range(M):\n s,c=map(int,input().split(' '))\n s = s-1\n if N != 1 and s==0 and c==0:\n print(-1)\n exit()\n l[s].append(c)\nans = []\nfor n,i in enumerate(l):\n if len(set(i)) >=2:\n print(-1)\n exit()\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s121496496', 's333590535', 's752236987', 's786331754', 's078874856'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 19.0, 17.0, 17.0, 17.0] | [573, 551, 370, 415, 422] |
p02761 | u476124554 | 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 val1,val2 = map(int,input().split())\n s.append(val1)\n c.append(val2)\n\nfor i in range(1000):\n if len(str(i)) == n:\n flg = True\n for j in range(m):\n if int(str(i)[j-1]) != c[j]:\n flg = F... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s230156633', 's858296872', 's043311600'] | [3064.0, 3064.0, 3064.0] | [18.0, 27.0, 18.0] | [390, 469, 572] |
p02761 | u477319617 | 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)]\nprint(sc)\nfor i in range(10**n):\n i2=str(i)\n print(i2)\n if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):\n print(i2)\n exit()\nprint(-1)', 'n,m=map(int,input().split())\nsc=[list(map(int,input().split())) for ... | ['Wrong Answer', 'Accepted'] | ['s105617996', 's141560808'] | [3188.0, 3064.0] | [19.0, 18.0] | [236, 240] |
p02761 | u480138356 | 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, M = map(int, input().split())\n ans = [-1] * N\n ok = True\n for i in range(M):\n s, c = map(int, input().split())\n if ans[s-1] != -1 or (N!=1 and c==0):\n ok = False\n ans[s-1] = c\n if ans[0] == -1:\n a... | ['Wrong Answer', 'Accepted'] | ['s156208802', 's014646683'] | [3188.0, 3064.0] | [19.0, 17.0] | [511, 599] |
p02761 | u481250941 | 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# abc157 c\n#\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n ou... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s489956435', 's598262061', 's012964357'] | [16240.0, 16712.0, 16148.0] | [77.0, 79.0, 73.0] | [1281, 1327, 1327] |
p02761 | u482157295 | 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 = [0]*m\nnum = [0]*m\nfor i in range(m):\n digit[i], num[i] = map(int, input().split())\nfor i in range(1000):\n dum = str(i)\n flag = "ok"\n for j in range(m):\n #print(j)\n if len(dum) == (n+1-digit[j]):\n if dum[digit[j]-1] != str(num[j]):\... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s076547710', 's249651815', 's632026617', 's666460753', 's668469460', 's691055670', 's887088339', 's021793362'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0, 9028.0] | [18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 19.0, 27.0] | [486, 943, 729, 769, 798, 729, 485, 378] |
p02761 | u487594898 | 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())\nP = []\nfor i in range (N):\n P.append(-1)\n\nA=[] \nwhile True:\n try:\n A.append(list(map(int,input().split())))\n\n except:\n break;\nprint(A,P)\n\nfor s in range(M):\n if P[A[s][0]-1]== -1 or P[A[s][0]-1] ==A[s][1]:\n P[A[s][0]-1] = A[s]... | ['Wrong Answer', 'Accepted'] | ['s255527288', 's390881357'] | [3064.0, 3064.0] | [17.0, 18.0] | [548, 660] |
p02761 | u488884575 | 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\nf= 0\nfor i in range(m):\n s,c = map(int, input().split())\n if (ans[s-1] != None) or (ans[s-1] != c):\n f = 1\n ans[s-1] = c\nif f == 1:\n print('-1')\n exit()\nelif ans[0] == None:\n ans[0] == 1\nelif ans[0] == 0:\n print('-1')\n exit(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s030611413', 's638389567', 's823973771'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [398, 427, 638] |
p02761 | u489155878 | 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\n\nN,M=map(int,input().split())\nT=[list(map(int,input().split())) for i in range(M)]\n\nA=[0 for i in range(N+1)]\nB=[0 for i in range(N+1)]済みフラグ\n\nt=0\nfor i in T:\n if B[i[0]]==1:済み\n if A[i[0]]!=i[1]:\n print(-1)\n t=1\n break\n \n else:\n A[i[0]]=i[... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s369250054', 's371203592', 's310201707'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0] | [620, 819, 983] |
p02761 | u489315616 | 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())\nx = [0] * m\ny = [0] * m\nr = [0] * n\nt = [0] * n\nfor i in range(m):\n x[i], y[i] = map(int, input().split())\n if t[x[i] - 1] == 0 and r[x[i] - 1] == y[i]:\n r[x[i] - 1] = y[i]\n t[x[i] - 1] = 1\n else:\n print(-1)\n exit()\nif n >... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s090896416', 's425762029', 's183584395'] | [2940.0, 3064.0, 3064.0] | [17.0, 17.0, 25.0] | [9, 352, 434] |
p02761 | u489959379 | 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 m == 0:\n if n == 1:\n print(0)\n else:\n print(10 ** (n - 1))\n exit()\n\nans = -1\nfor i in range(10 ** n):\n i = str(i)\n for s, c in sc:\n if int(i[s - 1]) != c:\n break\... | ['Runtime Error', 'Accepted'] | ['s415245035', 's779574237'] | [3064.0, 3064.0] | [19.0, 20.0] | [355, 708] |
p02761 | u490553751 | 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()]\ns = [0] * M\nc = [0] * M\nfor i in range(M):\n s[i],c[i] = [int(j) for j in input().split()]\nfind = [False] * N\nans = ['0'] * N\nfor i in range(M):\n sa = s[i] -1\n ca = c[i]\n if find[sa] == False:\n find[sa] = True\n ans[sa] = str(ca)\n con... | ['Wrong Answer', 'Accepted'] | ['s536900641', 's476987187'] | [3192.0, 3064.0] | [17.0, 19.0] | [499, 962] |
p02761 | u493318999 | 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())))\nsc.sort()\nprint(sc)\nfor i in range(m-1):\n if sc[i][0] == sc[i+1][0]:\n if sc[i][1] != sc[i+1][1]:\n print('-1')\n exit()\n if sc[i][0] == 1 and sc[i][1] == 0:\n prin... | ['Wrong Answer', 'Accepted'] | ['s196945476', 's022916337'] | [3064.0, 3064.0] | [17.0, 17.0] | [477, 539] |
p02761 | u494058663 | 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 copy\ndef main():\n n,m = map(int,input().split())\n ans = [10 for i in range(n+1)]\n num = 0\n if m==0:\n if n==1:\n print(0)\n else:\n print(10**(n-1))\n exit()\n for i in range(m):\n s,c = map(int,input().split())\n if ans[s-1] != 10:\n... | ['Wrong Answer', 'Accepted'] | ['s208112810', 's505147161'] | [9180.0, 9328.0] | [32.0, 34.0] | [691, 939] |
p02761 | u497952650 | 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 s,c = map(int,input().split())\n sc.append([s-1,c])\n\nA = [0]*3\nfor i in range(M):\n if A[sc[i][0]] == 0:\n A[sc[i][0]] = sc[i][1]\n else:\n if A[sc[i][0]] != sc[i][1]:\n print("-1")\n exit()\n\ncount = 0\n... | ['Wrong Answer', 'Accepted'] | ['s696084688', 's382720604'] | [3064.0, 3064.0] | [17.0, 18.0] | [619, 409] |
p02761 | u501451051 | 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())\nlis = []\nfor i in range(m):\n lis.append(list(map(int, input().split())))\n \ns =[0]*n\nfor j in lis:\n s[j[0]-1] = j[1]\n \n\n\ns1 = ""\nfor k in s:\n s1 += str(k)\n\ns1 = int(s1)\ns1 = str(s1)\n\nspe = 0\nif len(s1) != n:\n spe = 1\n \n\n\nflag = 0\nfor i in ra... | ['Wrong Answer', 'Accepted'] | ['s012531691', 's311847099'] | [3064.0, 3064.0] | [19.0, 19.0] | [423, 378] |
p02761 | u502508885 | 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 k in range(m):\n s[k], c[k] = list(map(int, input().split()))\n\nfor l in range(m):\n if n == 1:\n if s[l] != 1:\n print(-1)\n exit()\n elif n == 2:\n if s[l] == 3 or (s[l] == 1 and c[l] == 0):\n ... | ['Runtime Error', 'Accepted'] | ['s952260313', 's566305511'] | [3064.0, 3188.0] | [17.0, 21.0] | [1173, 1501] |
p02761 | u506858457 | 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 i in range(M):\n s,t=map(int,input().split())\n if s in d:\n if d[s]!=t:\n print('-1')\n exit()\n if s==1:\n if t==0:\n print('-1')\n exit()\n d[s]=t\nif 1 not in d:\n d[1]=1\nfor i in range(2,N):\n if i not in d:\n d[i]=0\nL=[]\nfor i in d.va... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s054527948', 's394273174', 's397809647', 's624929218', 's684509325'] | [3064.0, 3064.0, 3064.0, 3064.0, 9200.0] | [17.0, 18.0, 17.0, 18.0, 28.0] | [343, 329, 486, 417, 416] |
p02761 | u508164527 | 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 = [0]*M\nc = [0]*M\nfor i in range(M):\n s[i], c[i] = [int(p) for p in input().split()]\n\nn = [0]*N\n\nfor j in range(len(s)):\n if N > 1 and s[j] == 1 and c[j] == 0:\n print(-1)\n exit()\nfor p in range(len(s)):\n for q in range(len(s)):\n if p == q:\n pa... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s698970006', 's746096231', 's922980809'] | [3064.0, 3192.0, 3192.0] | [17.0, 18.0, 18.0] | [566, 556, 557] |
p02761 | u509739538 | 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 queue\nfrom collections import defaultdict\n \ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s131956234', 's512591281', 's588137186', 's630765031', 's647678281', 's884162150'] | [3064.0, 3952.0, 3064.0, 3064.0, 3064.0, 3944.0] | [18.0, 26.0, 18.0, 17.0, 18.0, 29.0] | [1313, 1284, 1329, 1347, 1322, 1309] |
p02761 | u509784400 | 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... | ['line = input().split()\nN, M = int(line[0]), int(line[1]) \n\nif M == 0:\n return 10**N\n\nconds = []\nfor i in range(M):\n line = input().split()\n conds.append((int(line[0]),int(line[1])))\n \nNUM = [-1] * N\n \nisOK = True\nfor curCon in conds:\n s = curCon[0]\n dig = curCon[1]\n \n if NUM[s-1] == -1:\n ... | ['Runtime Error', 'Accepted'] | ['s606868638', 's943193676'] | [3064.0, 3188.0] | [17.0, 19.0] | [595, 673] |
p02761 | u510331904 | 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\nimport sys\nimport math\nimport decimal\nimport itertools\nfrom itertools import product\nfrom functools import reduce\ndef input():\n return sys.stdin.readline()[:-1]\n\ndef main():\n N, M = map(int, input().split())\n s = [0] * M\n c = [0] * M\n for i in range(M):\n s[i... | ['Wrong Answer', 'Accepted'] | ['s799706406', 's728708518'] | [9988.0, 9992.0] | [35.0, 36.0] | [926, 1328] |
p02761 | u511449169 | 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)]\nlis = [str(0)]*n\nfor i in s:\n if lis[int(i[0]) - 1] != "0":\n lis[int(i[0]) - 1] = str(i[-1])\n else:\n print(-1)\n exit()\nlis = int("".join(lis))\nif lis == 0:\n print(-1)\nelse:\n print(lis... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s345704771', 's756389287', 's575952511'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [306, 327, 385] |
p02761 | u511824539 | 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 = [x for x in str(10**(N - 1))]\nconfirmed_or_not = [False] * N\n\nfor _ in range(M):\n s, c = map(int, input().split())\n if s > N:\n num = ['-1']\n break\n \n if s == 1 and c == 0:\n if N > 1:\n num = ['-1']\n break\n ... | ['Wrong Answer', 'Accepted'] | ['s565775817', 's160113196'] | [3188.0, 3064.0] | [22.0, 17.0] | [530, 491] |
p02761 | u511870776 | 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 y in range(N)]\n\n\nfor x in range(M):\n s, c = map(int, input().split())\n if s+1 > len(num):\n print(-1)\n exit()\n num[s-1] = str(c)\n\nprint("".join(num) if num[0] != "0" else -1)\n\n\n\n', 'N, M = map(int, input().split())\nnum = [input().sp... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s402461524', 's434044829', 's612181659', 's999333340', 's068428819'] | [3060.0, 3060.0, 3064.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 20.0, 18.0] | [248, 338, 459, 311, 335] |
p02761 | u512138205 | 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 calc():\n mp = {}\n n, m = map(int, input().split())\n for i in range(0, m):\n s, c = map(int, input().split())\n if s in mp and mp[s] != c:\n return -1\n else:\n mp[s] = c\n res = 0\n if n == 1:\n res = mp[1] if 1 in mp else 0\n else:\n f... | ['Wrong Answer', 'Accepted'] | ['s755564955', 's976220744'] | [3064.0, 3064.0] | [19.0, 17.0] | [583, 610] |
p02761 | u512212329 | 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 digits, orders = [int(x) for x in input().split()]\n number = [-1] * digits\n for _ in range(orders):\n left_count, numeral = [int(x) for x in input().split()]\n left_count -= 1\n if number[left_count] != -1:\n # already assigned!\n if number[left_coun... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s104180806', 's737777612', 's323262827'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [666, 681, 900] |
p02761 | u515052479 | 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\nnum = list(map(int,input().split()))\n\nmatrix = np.ones(num[0]) * (-1)\nsign_0 = []\nsign_1 = []\nans = 0\n\nif num[1] == 0:\n if not matrix[0] == 0:\n ans = 10**(num[0]-1)\n elif matrix[0] == 0:\n ans = -1\n\nelif not num[1] == 0:\n for i in range(0,num[1]):\n temp = list(map(int,i... | ['Runtime Error', 'Accepted'] | ['s753531093', 's925757613'] | [3064.0, 12396.0] | [17.0, 148.0] | [926, 479] |
p02761 | u518386853 | 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())))\nans = 0\ns = set()\nketa = set()\nfor i in range(m):\n preans = sc[i][1]*(10**(n-sc[i][0]))\n if sc[i][0] in keta and preans not in s:\n print(-1)\n break\n elif sc[i][0] not in keta:... | ['Runtime Error', 'Accepted'] | ['s278265562', 's465568102'] | [3064.0, 3064.0] | [17.0, 17.0] | [514, 557] |
p02761 | u518891382 | 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... | ["bingo = []\nfor _ in range(3):\n bingo.append(list(map(int,input().split())))\n\ncl = [[0,0,0],[0,0,0],[0,0,0]]\n\nn = int(input())\nst = set()\nfor _ in range(n):\n st.add(int(input()))\n\nfor _ in range(len(st)):\n for i in range(3):\n for j in range(3):\n if bingo[i][j] in st:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s300348271', 's624286498', 's550525380'] | [9116.0, 9260.0, 9244.0] | [28.0, 26.0, 29.0] | [596, 596, 419] |
p02761 | u520843951 | 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 solve(n, m):\n ans = [-1]*n\n for _ in range(m):\n s, c = map(int, input().split())\n s = s-1\n if ans[s] == c:\n continue\n elif ans[s] == -1:\n ans[s] = c\n else:\n return -1\n\n if ans[0] == '0':\n if n == 1:\n retur... | ['Runtime Error', 'Accepted'] | ['s337024009', 's908041074'] | [3064.0, 3064.0] | [19.0, 18.0] | [501, 601] |
p02761 | u527993431 | 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=[]\nA=[0]*N\nif N>1:\n A[0]=1\nX=[]\nY=[]\nZ=[]\nfor i in range(M):\n\tx,y=map(int,input().split())\n\tS.append(x)\n\tC.append(y)\nfor i in range(M):\n\tif S[i]==1:\n\t\tX.append(C[i])\n\tif S[i]==2:\n\t\tY.append(C[i])\n\tif S[i]==3:\n\t\tZ.append(C[i])\nif len(set(X))>1:\n\tpr... | ['Wrong Answer', 'Accepted'] | ['s300883542', 's859849414'] | [3064.0, 3064.0] | [17.0, 17.0] | [601, 521] |
p02761 | u528748570 | 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())\ndata = [list(map(int, input().split())) for _ in range(M)]\n\n# condition[1:N+1]\nhantei = True\ncondition = [None] * (N+1)\ncondition[0] = 0\nS = []\nfor s, c in data:\n if condition[s] is None:\n condition[s] = c\n S.append(s)\n else:\n break\nelse:\n ... | ['Wrong Answer', 'Accepted'] | ['s835847996', 's717786610'] | [3064.0, 3064.0] | [17.0, 17.0] | [616, 679] |
p02761 | u529106146 | 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\ns = [0,]*M\nc = [0,]*M\nans =[10,]*N\n\n\n\n\nfor i in range(M):\n s[i], c[i] = map(int, input(). split())\n if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:\n print(-1)\n sys.exit()\n else:\n ans[s[i]-1] = c[i] \n\nif N == 1:\n print... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s407515793', 's503666851', 's773129914', 's133945401'] | [3064.0, 3064.0, 3064.0, 3064.0] | [19.0, 18.0, 17.0, 17.0] | [826, 672, 654, 878] |
p02761 | u531599639 | 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())\no = {}\nif N==1 and M==0:\n print(0)\nelse:\n for i in range(M):\n s,c = map(int,input().split())\n if o.get(s,-1)==-1:\n o[s]=c\n elif o.get(s,-1)!=-1 and o[s]!=c:\n print(-1)\n break\n else:\n m = [1]+[0]*(N-1)\n for k in o.keys():\n m[k-... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s182637350', 's484382369', 's858115018'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [407, 440, 404] |
p02761 | u537538698 | 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 r1 = input()\n n, m = map(int, r1.split(" "))\n v = ["~"] * n\n for v in range(m):\n r = input()\n s, c = map(int, r1.split(" "))\n v[s] = c\n if v[s] != "~" and v[s] != c:\n print(-1)\n return\n for x in range(len(v)):\n if v[x] ==... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s250587950', 's349421273', 's765066082'] | [3316.0, 3064.0, 3064.0] | [19.0, 17.0, 17.0] | [490, 517, 555] |
p02761 | u538361257 | 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 = [-1 for i in range(N)]\nflag = False\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 continue\n else:\n flag = True\n break\n\nif len(ans) > 1 and ans[0]:\n ans[0] = ... | ['Wrong Answer', 'Accepted'] | ['s220220001', 's401954768'] | [3064.0, 3064.0] | [17.0, 18.0] | [494, 500] |
p02761 | u538537141 | 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... | ['\nN,M=map(int,input().split())\nslist=[]\nfor i in range(M):\n slist.append(list(map(int,input().split())))\nans=["0"]*N\n\n\nfor i in range(len(slist)):\n print("i",i)\n if ans[slist[i][0]-1] == "0":\n ans[slist[i][0]-1] = slist[i][1]\n elif ans[slist[i][0]-1] != slist[i][1]:\n ans=["-1"]\n... | ['Wrong Answer', 'Accepted'] | ['s478877968', 's908935509'] | [3064.0, 3064.0] | [17.0, 18.0] | [488, 466] |
p02761 | u539367121 | 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' + '0'*(N-1) if M>1 else '0'\nchk=[False]*N\n\nfor m in range(M):\n s, c = map(int, input().split())\n if s==1 and c==0:\n print(-1); exit(0)\n if chk[s-1] and c!=ans[s-1]:\n print(-1); exit(0)\n chk[s-1]=True\n ans = ans[:s-1] + str(c) + ans[s:]\n #print(chk, ans)... | ['Wrong Answer', 'Accepted'] | ['s188709862', 's482525920'] | [9136.0, 9064.0] | [28.0, 26.0] | [317, 323] |
p02761 | u539850805 | 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 = ['-1' for i in range(n)]\nf = 1\nfor _ in range(m):\n s, c = map(int, input().split())\n if res[s-1] == '-1' or res[s-1] == str(c):\n res[s-1] = str(c)\n else:\n f = 0\nif not f:\n print(-1)\n exit()\nif res[0] == '0' or res[0] == '-1':\n if n ==... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s950938807', 's965566692', 's886870482'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [544, 459, 544] |
p02761 | u540631540 | 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())\na = [0] * n\nd = {}\nok = True\nfor i in range(m):\n s, c = map(int, input().split())\n if s not in d or d[s] == c:\n d[s] = c\n a[s - 1] = c\n else:\n ok = False\nif n != 1 and 1 not in d:\n a[0] = 1\nif ok and a[0] != 0:\n print(*a, ... | ['Wrong Answer', 'Accepted'] | ['s943685967', 's413574229'] | [2940.0, 3064.0] | [18.0, 17.0] | [9, 351] |
p02761 | u541318412 | 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\nc = []\nfor i in range(m):\n c.append(list(map(int,input().split())))\n\nmax = 0\nfor i in range(m):\n if c[i][0] >= max:\n max = c[i][0]\n\nans = -1\nfor i in range(pow(10,max-1),pow(10,n)):\n tmp = 0\n for j in range(m):\n if str(i)[c[j][0]-1] == str(c[j][... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s085380763', 's246002170', 's365435046', 's867189968', 's410920980'] | [3064.0, 3064.0, 3192.0, 3064.0, 3064.0] | [19.0, 20.0, 19.0, 19.0, 18.0] | [376, 552, 542, 497, 583] |
p02761 | u541921833 | 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().rstrip().split())\nd = {}\nsuccess_flg = True\nfor _ in range(M):\n s, c = map(int, input().rstrip().split())\n if s == 0:\n success_flg = False\n break\n if s > N:\n success_flg = False\n break\n elif s in d.keys() and c != d[s]:\n success_flg = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s839452929', 's961009933', 's492927230'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [768, 936, 941] |
p02761 | u548525760 | 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 = []\nneg = 0\nfor n in range(N):\n ans.append(-1)\n\nprint(ans)\n\nfor m 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 pass\n else:\n neg = -1\n break\n\nprint(ans)\n\nfor j in range(len(ans)):\n i... | ['Wrong Answer', 'Accepted'] | ['s226299679', 's849511297'] | [9240.0, 9236.0] | [29.0, 27.0] | [450, 466] |
p02761 | u549278479 | 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 = map(int, input().split())\ns = [0]*M\nc = [0]*M\n\nif(M==0 and N==1):\n print("0")\nelif(M==0 and N>1):\n ans_print = "1"\n for i in range(N-1):\n ans_print += "0"\n print(ans_print)\nelse:\n for i in range(M):\n s[i], c[i] = map(int, input().split())\n\n ans = [-1]*N\n... | ['Wrong Answer', 'Accepted'] | ['s142282167', 's592370675'] | [3064.0, 3188.0] | [18.0, 19.0] | [801, 818] |
p02761 | u549383771 | 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,M,K = map(int,input().split())\nanswer_list = [0]*N\nfrend_list = [[0] * N for i in range(N)]\nflag_list = [0]*N\nfor i in range(M):\n num_list= list(map(int,input().split()))\n frend_list[num_list[0]-1][num_list[1]-1] = 1\n frend_list[num_list[1]-1][num_list[0]-1] = 1\n\nfor i in range... | ['Runtime Error', 'Accepted'] | ['s258500734', 's749585794'] | [12416.0, 3064.0] | [151.0, 20.0] | [821, 647] |
p02761 | u549494450 | 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 = input().split(" ")\nN = int(a[0])\nM = int(a[1])\nans1 = 10\nans2 = 10\nans3 = 10\nfor i in range(M):\n b = input().split(" ")\n c = int(b[0])\n d = int(b[1])\n if c == 1:\n if d == 0:\n if N == 1:\n ans1 = d:\n elif d < ans1:\n ans1 = d\n elif c =... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s022237492', 's938513417', 's880055672'] | [2940.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [708, 964, 1051] |
p02761 | u552143188 | 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 s1,c1=[int(i) for i in input().split()]\n s.append(s1)\n c.append(c1)\n\nans = [10 for i in range(N)]\nx = ''\n\nfor j in range(M):\n if ans[s[j]-1] == 10:\n ans[s[j]-1] = c[j]\n elif ans[s[j]-1] != 10 and ans[s[j]-1] != c[j]:\n p... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s126650935', 's285928177', 's286804082'] | [3188.0, 3064.0, 3064.0] | [19.0, 17.0, 17.0] | [572, 561, 644] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.