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 | u716270596 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\n\nn, m = list(map(int, input().split()))\n\n# c = []\n# idx = 0\n\n\ndef solve(n, m):\n sc = dict()\n\n for _ in range(m):\n si, ci = list(map(int, input().split()))\n if si in sc.keys() and sc[si] != ci:\n return -1\n else:\n sc[... | ['Wrong Answer', 'Accepted'] | ['s508117775', 's128189117'] | [3064.0, 3064.0] | [17.0, 17.0] | [653, 684] |
p02761 | u718949306 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = True\nA = [0]*N\nB = ''\nS = []\nC = []\nfor m in range(M):\n s, c = map(int, input().split())\n S.append(s)\n C.append(c)\nT = max(S)\ncnt = -1\nman = False\nfor n in range(1, 1000):\n num = str(n)\n res = True\n for m in range(M):\n if len(num) != N:\... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s534574872', 's892759669', 's070473842'] | [3064.0, 3064.0, 3188.0] | [20.0, 17.0, 19.0] | [504, 763, 464] |
p02761 | u726615467 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = ['A'] * N\nfor i, (si, ci) in enumerate(sc):\n if ans[si - 1] != 'A' and ans[si - 1] != str(ci):\n ans = -1\n break\n #\n ans[si - 1] = str(ci)\n\nif ans == -1:\n print(ans)\nelse:\n ans = ... | ['Wrong Answer', 'Accepted'] | ['s017778281', 's388160410'] | [3064.0, 3064.0] | [17.0, 17.0] | [463, 602] |
p02761 | u727407185 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["File Edit Options Buffers Tools Python Help \nn, m = [int(x) for x in input().split()]\nsc = [[int(x) for x in input().split()] for i in range(m)]\nr = [-1] * n\ndef solution():\n for s, c in sc:\n if r[s - 1] >= 0 and r[s - 1] != c or (s == 1 and c == 0 and n != ... | ['Runtime Error', 'Accepted'] | ['s368569319', 's803916752'] | [2940.0, 3064.0] | [17.0, 17.0] | [562, 515] |
p02761 | u727787724 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nc=[]\nfor i in range(m):\n c.append(list(map(int,input().split())))\nans=[-1 for i in range(n)]\ncnt=0\nfor i in range(m):\n if ans[c[i][0]-1]==-1:\n ans[c[i][0]-1]=c[i][1]\n else:\n if ans[c[i][0]-1]==c[i][1]:\n continue\n else:\n cnt+... | ['Wrong Answer', 'Accepted'] | ['s029135708', 's711175984'] | [3064.0, 3064.0] | [17.0, 18.0] | [652, 759] |
p02761 | u728120584 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [input().split() for i in range(M)]\n\nk3 = 10\nk2 = 10\nk1 = 10\n\n\nfor i in range(M):\n if P[i][0] == '3':\n k1 = min(k1, int(P[i][1]))\n elif P[i][0] == '2':\n k2 = min(k2, int(P[i][1]))\n else:\n k3 = min(k3, int(P[i][1]))\n\nans = k3 * 100 + k2... | ['Wrong Answer', 'Accepted'] | ['s982390342', 's327083364'] | [3064.0, 3064.0] | [17.0, 18.0] | [587, 446] |
p02761 | u728473456 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\na = [0] * n\nfor i in range(m):\n s[i],c[i] = map(int,input().split())\n#\nans = 0\nfor j in range(m):\n if n != 1:\n if s[j] == 1 and c[j] == 0:\n ans = -1\n else:\n if a[s[j] - 1] == 0:\n a[s[j] - 1] =... | ['Wrong Answer', 'Accepted'] | ['s745161138', 's992756484'] | [3064.0, 3064.0] | [18.0, 17.0] | [786, 1059] |
p02761 | u729938879 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nflg = True\nfor i in range(m):\n s, c = map(int,input().split())\n if a[s-1] == -1:\n a[s-1] = c\n else:\n flg = False\n break\nif a[0] == 0:\n flg = False\nelif a[0] == -1:\n a[0] = 1\n\nif flg:\n num = 0\n for i in range(len(a))... | ['Wrong Answer', 'Accepted'] | ['s888495053', 's888619827'] | [3064.0, 3064.0] | [17.0, 18.0] | [400, 517] |
p02761 | u731322489 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [list(map(int, input().split())) for _ in range(m)]\n\nans = -1\nfor i in range(10 ** (n - 1) - 1, 10 ** n):\n tmp = str(i)\n flg = False\n for l in lst:\n if tmp[l[0] - 1] == str(l[1]):\n flg = True\n break\n if flg == True:\n an... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s175205294', 's678874825', 's697432546', 's814073517', 's542022765'] | [3064.0, 3064.0, 3316.0, 3064.0, 3064.0] | [18.0, 18.0, 20.0, 18.0, 18.0] | [337, 513, 396, 372, 370] |
p02761 | u731436822 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nflag = False\nl = [0]*3\nfor i in range(m):\n l[SC[i][0]-1] = SC[i][1]\n if flag == True:\n break\n for j in range(1,m-i):\n if SC[i][0] == SC[j][0]:\n if l[SC[i][0]-1] != l[SC[j][0]-1]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s205251431', 's840758937', 's995182855', 's803185666'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0, 19.0] | [592, 571, 556, 379] |
p02761 | u736470924 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 - 1)\n C.append(c)\n\nnum = ['*'] * N\n\nfor s, c in zip(S, C):\n if s == 0 and c == 0 and N != 1:\n print(-1)\n exit()\n if num[s] == '*':\n num[s] = str(c)\n elif num[s] != str(c):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s278152728', 's300591155', 's626987509'] | [3064.0, 3068.0, 3064.0] | [19.0, 18.0, 18.0] | [362, 9, 407] |
p02761 | u736848749 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nchk = [-1] * N \nans=0\n\n\nfor m 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 chk[s-1] == -1: \n chk[s-1]=c\n elif chk[s-1] != -1: \n if chk[s-1] != c: \n print(-1)\n ... | ['Wrong Answer', 'Accepted'] | ['s938564051', 's273789163'] | [3064.0, 3064.0] | [18.0, 17.0] | [815, 826] |
p02761 | u737298927 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nfor i in range(m):\n s, c = map(int, input().split())\n if ans[s - 1] is None:\n ans[s - 1] = c\n else:\n print(ans[s-1],c)\n ans[s - 1] = min(ans[s - 1], c)\n print(ans)\n\nansp = ""\nif ans[0] is None and n == 1:\n print("0")\... | ['Wrong Answer', 'Accepted'] | ['s510606230', 's482690872'] | [3064.0, 3064.0] | [17.0, 19.0] | [478, 413] |
p02761 | u737321654 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nrules = [list(map(int, input().split())) for i in range(M)]\nans = '-1'\nnum = '1' + '0'*(N-1)\nidxes = []\n\nfor rule in rules:\n num = num[:rule[0]-1] + str(rule[1]) + num[rule[0]:]\n\nif num[0] != '0':\n ans = num\nelif num[0] == '0' and N == 1:\n ans = '0'\n \nfor rule... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s054964665', 's165988276', 's539529446'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0] | [424, 575, 575] |
p02761 | u740284863 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nquery = [list(map(int,input().split())) for _ in range(m)]\nfor i in range(10**n):\n k = str(i)\n flag = True\n for s,c in query:\n if k[s-1] != c:\n flag = False\n if flag and len(k) == n:\n print(i)\n exit()\nprint(-1)', 'n,m = map(int,inpu... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s235345549', 's550597845', 's569369726', 's958703355', 's082193394'] | [3064.0, 3064.0, 3060.0, 3064.0, 3064.0] | [18.0, 17.0, 18.0, 17.0, 18.0] | [285, 752, 290, 752, 556] |
p02761 | u740909619 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nsl = []\ncl = []\nfor i in range(M):\n s,c = map(int,input().split())\n s -= 1\n sl.append(s)\n cl.append(c)\nfor i in range(1000):\n digit = list(str(i))\n if len(digit) != N:\n continue\n flag = True\n\n for j in range(M):\n print(sl[j])\n ... | ['Wrong Answer', 'Accepted'] | ['s218324776', 's986451534'] | [3572.0, 3064.0] | [22.0, 19.0] | [441, 392] |
p02761 | u744115306 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["n,m = map(int,input().split())\n\nl = ['a']*(n+1)\nfor i in range(m):\n s,c = map(int,input().split())\n if l[s-1] == 'a':\n l[s-1] = c\n else:\n if l[s-1] != c:\n l[n] = 1\n\nif l[0] == 'a' or '0':\n l[n] = 1\n\nif l[n] == 1:\n print(-1)\nelse:\n for i in range(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s617690860', 's589401137'] | [3064.0, 3064.0] | [17.0, 17.0] | [410, 605] |
p02761 | u746419473 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 _s, _c = map(int, input().split())\n s.append(_s)\n c.append(_c)\n\nfor i in range(1000):\n *t, = map(int, list(str(i)))\n\n if len(t) != n:\n continue\n\n ok = True\n for j in range(m):\n if t[s[j]] != c[j]:\n ... | ['Runtime Error', 'Accepted'] | ['s786393396', 's503229081'] | [3064.0, 3064.0] | [19.0, 20.0] | [395, 397] |
p02761 | u746849814 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nflag = False\n\nused = []\nd = [0]*n\nfor _ in range(m):\n s, c = map(int, input().split())\n if n > 1 and (s == 1 and c == 0):\n flag = True\n if s in used:\n flag = True\n else:\n d[s-1] = c\n used.append(s)\n \nif flag:\n print(-1)\n... | ['Wrong Answer', 'Accepted'] | ['s954708379', 's029341678'] | [3064.0, 3064.0] | [17.0, 17.0] | [372, 402] |
p02761 | u747703115 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = pow(10, n-1)\nS = []\nC = []\nfor i in range(m):\n s, c = map(int, input().split())\n if s in S:\n if C[S.index(s)] != c:\n r = -1\n break\n if s==1 and c==0:\n r = -1\n break\n else:\n S.append(s)\n C.append(c)... | ['Wrong Answer', 'Accepted'] | ['s415606231', 's429198230'] | [3064.0, 3064.0] | [17.0, 17.0] | [411, 593] |
p02761 | u749770850 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = []\nfor i in range(m):\n s.append(list(map(int, input().split())))\n\nif n == 1:\n a = [str(i) for i in range(10)]\nelif n == 2:\n a = [str(i) for i in range(10:100)]\nelif n == 3:\n a = [str(i) for i in range(100:1000)]\n\nans = []\n\nfor i in a:\n b = True\n ... | ['Runtime Error', 'Accepted'] | ['s537383696', 's051364714'] | [2940.0, 3064.0] | [17.0, 19.0] | [481, 481] |
p02761 | u760771686 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['hashmap = {}\nN, M = map(int,input().split()) \nP = [list(map(int,input().split())) for i in range(M)]\n\n# N, M = 3, 2\n# P = [[2,1],[2,3]]\n\ndef func():\n for l in P:\n if l[0] in hashmap and hashmap[l[0]]!=l[1]:\n return -1\n else:\n hashmap[l[0]]=l[1]\n\n ans = ""\n i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s905906940', 's994199386', 's475947607'] | [3064.0, 3064.0, 9212.0] | [17.0, 17.0, 30.0] | [524, 477, 422] |
p02761 | u760794812 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = ['a']*N\nfor _ in range(M):\n s,c = map(int,input().split())\n if A[s-1] !='a' and A[s-1] != c:\n print(-1)\n exit()\n else:\n A[s-1] = c\n\nfor i in range(N):\n if A[0] == 'a' and N==3:\n A[0] = 1\n else A[i] == 'a':\n A[i] = 0\nAnswer = ''.join(map(str,A))\n\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s473509749', 's811153911', 's634754735'] | [3064.0, 3064.0, 9112.0] | [18.0, 17.0, 27.0] | [402, 254, 385] |
p02761 | u764956288 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\n# S = input()\n# N, M = map(int, input().split())\n# As = [int(input()) for _ in range(N)]\n# nums = list(map(int, input().split()))\n# nums_2d = [list(map(int, input().split())) for _ in range(N)]\n\n\ndef main():\n print(solve())\n\n\ndef solve():\n N, M = map(int, input().split())\n\n scs = ... | ['Wrong Answer', 'Accepted'] | ['s774781755', 's745863059'] | [3064.0, 3064.0] | [17.0, 17.0] | [779, 784] |
p02761 | u765865533 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nSC=[]\nfor i in range(M):\n SC.append(list(map(int,input().split())))\n\nimport numpy as np\nSC=np.array(SC)\n\n\nketa=np.unique(SC[:,0])\nflag=0\nfor i in keta:\n if len(np.unique(SC[SC[:,0]==i]))>=3:\n flag=1\nfor x in SC[SC[:,0]==1]:\n if x[1]==0:\n flag=1\n\n... | ['Runtime Error', 'Accepted'] | ['s281753258', 's373734794'] | [12452.0, 3064.0] | [151.0, 17.0] | [481, 425] |
p02761 | u767664985 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nans_flag = [0] * N \n\nfor _ in range(M):\n s, c = map(int, input().split())\n if N != 1 and s == 1 and c == 0: \n print(-1)\n exit()\n elif ans_flag[s-1] == 1 and ans[s-1] != c:\n print(-1)\n exit()\n else:\n ans[s-1] =... | ['Wrong Answer', 'Accepted'] | ['s062288390', 's515801269'] | [3064.0, 3064.0] | [17.0, 19.0] | [583, 555] |
p02761 | u769870836 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m=map(int,input().split())\nl=[]\nfor i in range(m):\n a,b=map(int,input().split())\n l.append([a,b])\nfor i in range(10**(n-1)-1,10**n):\n x=str(i)\n c=0\n for i in range(m):\n if x[l[i][0]-1]==str(l[i][1]):\n c+=1\n if c==m:\n print(x)\n quit()\nprint(-1)', 'n,m=map(int,input().split())\nl=[]\... | ['Runtime Error', 'Accepted'] | ['s069070450', 's783860683'] | [3064.0, 3064.0] | [18.0, 19.0] | [265, 294] |
p02761 | u771383254 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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, c = [], []\nfor _ in range(m):\n s_, c_ = map(int, input().split())\n s.append(s_)\n c.append(c_)\n\nflg = False\nfor i in range(10**n):\n for j in range(m):\n if str(i)[s[j]-1] != str(c[j]):\n break\n else:\n print(i)\n flg = True\n break\nif not flg:\n p... | ['Runtime Error', 'Accepted'] | ['s883528604', 's482669401'] | [9200.0, 9168.0] | [27.0, 29.0] | [308, 283] |
p02761 | u777496561 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(dic, n, bad):\n if bad:\n return -1\n\n li = [-1]*n\n for k, v in dic.items():\n li[k-1] = v\n\n if n==1:\n if li[0] == -1: ## unset\n return 0\n else: ## li is obviously set by dictionary\n st = map(str, li)\n return int(''.join(st))\... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s310337731', 's618355622', 's641915501', 's831066993'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0] | [1112, 1093, 1071, 1124] |
p02761 | u779728630 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\n\nif N == 1:\n ans = "*"\nelif N == 2:\n ans = "**"\nelse: #N==3\n ans = "***"\n\n \nng = False\nfor i in range(M):\n s, c = input().split()\n s = int(s)\n if ans[s] != \'*\' or ans[s] != c:\n ng = True\n break\n else:\n ans[s] = c\n\nif N == 1 and ans == "*":\n ans... | ['Runtime Error', 'Accepted'] | ['s171832593', 's851551755'] | [3064.0, 3064.0] | [17.0, 17.0] | [552, 635] |
p02761 | u785578220 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["dp = [[0]*3 for i in range(3)]\nL = []\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nc = list(map(int,input().split()))\nL = [a,b,c]\nn = int(input())\nl = []\nfor i in range(n):\n l.append(int(input()))\n\nflag = 0 \n\nfor i in range(3):\n for j in range(3):\n if L[i][j] in l:... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s288807752', 's697986446', 's819337638'] | [3064.0, 2940.0, 3188.0] | [17.0, 17.0, 20.0] | [691, 647, 649] |
p02761 | u787131053 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 No():\n print("-1")\n exit()\n\nN,M = map(int, input().split(" "))\n\n# print(N+M)\n \nS = []\nC = []\nFlag = True\n\nfor i in range(0,M):\n s,c = map(int, input().split(" "))\n for j in range(0, len(S)):\n if s == S[j] and c != C[j]:\n Flag = False\n S.append(s)\n C.append(... | ['Wrong Answer', 'Accepted'] | ['s691787626', 's469820875'] | [3064.0, 3064.0] | [17.0, 17.0] | [986, 990] |
p02761 | u790048565 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nguess = []\nfor _ in range(M):\n s, c = map(int, input().split())\n guess.append([s, c])\n\nfor n in range(pow(10, N)):\n if (len(str(n)) != N):\n continue\n \n valid = True\n for s_c in guess:\n keta = s_c[0]\n index = keta - 1\n if (str(n)[index] != str(s_c[1]))... | ['Runtime Error', 'Accepted'] | ['s240100305', 's508628911'] | [3064.0, 3064.0] | [17.0, 18.0] | [418, 435] |
p02761 | u794066762 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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=[0 for i in range(n)]\n\nim= False\nfor i in range(m):\n\tx,y= map(int,input().split(' '))\n\tif x==1 and y==0:\n\t\tim=True\n\tif arr[x-1]!=-1 and arr[x-1]!=y:\n\t\tim=True\n\tarr[x-1]=y\nif arr[0]==0:\n\tarr[0]=1\nif im:\n\tprint(-1)\nelse:\n\tprint(''.join(str(i) for i in arr)... | ['Wrong Answer', 'Accepted'] | ['s461756857', 's792107980'] | [3064.0, 3188.0] | [19.0, 20.0] | [292, 307] |
p02761 | u796842765 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = ["x"]*N\nfor a, b in zip(S, C):\n if A[a-1] == "x":\n A[a-1] = b\n else:\n if b == A[a-1]:\n A[a-1] = b\n else:\n print(-1)\n exit()\n\nif N != 1 and A[0] == "x":\n A[0] = 1\n\nif A[0] == "x":\n if N != 1:\n print(-1)\n exit()\nif A[0... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s157964277', 's902457566', 's947720056', 's447730111'] | [3064.0, 3064.0, 3064.0, 9208.0] | [19.0, 18.0, 20.0, 30.0] | [437, 276, 467, 497] |
p02761 | u797572808 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['s = input().split()\nn = int(s[0])\nm = int(s[1])\n\n\ninit = list(input().split() for _ in range(m))\n\nn_box = list(False for _ in range(n))\n\nflag = 0\n\n\n\n\nfor i in range(m):\n if(n_box[int(init[i][0])-1] == False or n_box[int(init[i][0])-1] == init[i][1]):\n n_box[int(init[i][0])-1] = init[i][1]\n ... | ['Wrong Answer', 'Accepted'] | ['s403073801', 's670305381'] | [3064.0, 3064.0] | [18.0, 17.0] | [641, 839] |
p02761 | u798818115 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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# Your code here!\nN,M=map(int,input().split())\n\nl=[]\nfor _ in range(M):\n s,t=map(int,input().split())\n l.append([s,t])\n\nfor i in range(10**(N-1),10**N):\n #print(i)\n temp=list(str(i))\n judge=True\n for s,t in l:\n if temp[N-s]!=str(t):\n judge=False\n if... | ['Wrong Answer', 'Accepted'] | ['s849492060', 's729898819'] | [3060.0, 3060.0] | [19.0, 18.0] | [353, 362] |
p02761 | u799215419 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nexists = True\ndigits = [-1]*N\n\nfor i in range(M):\n s, c = map(int, input().split())\n if digits[s-1] == -1 or digits[s-1] == c:\n digits[s-1] = c\n else:\n exists = False\n break\n\nans = 0\ndigits = list(reversed(digits))\nprint(digits)\nfor i in ra... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s713607056', 's895673153', 's490168297'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [751, 535, 606] |
p02761 | u799691369 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [10 for _ in range(N)]\n\nfor i in range(M):\n s, c = map(int, input().split())\n s -= 1\n\n A[s] = min(A[s], c)\n\nfor i in range(N):\n if A[i] == 10:\n A[i] = 0\n A[i] = str(A[i]) \n\nprint(A)\nans = int(''.join(A))\n\nif len(str(ans)) == N: print(ans)\nel... | ['Wrong Answer', 'Accepted'] | ['s442872577', 's938260378'] | [3064.0, 3064.0] | [17.0, 18.0] | [313, 554] |
p02761 | u800058906 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["import sys\nn,m=map(int,input().split())\nsc=[list(map(int,input().split())) for i in range(m)]\n\nnum=[0]*n\n\nfor i in range(m):\n if sc[i][0]==0:\n print('-1')\n sys.exit()\n if num[sc[i][0]-1]!=0 and num[sc[i][0]-1]!=sc[i][1]:\n print('-1')\n sys.exit()\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s015099103', 's836794604'] | [9228.0, 9240.0] | [31.0, 29.0] | [508, 538] |
p02761 | u801049006 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 s = []\n c = []\n for i in range(M):\n si, ci = map(int, input().split(\' \'))\n s.append(si)\n c.append(ci)\n \n ans = [0]*N\n flag = False\n for i in range(M):\n if ans[s[i]-1] == 0:\n ans[s[i]-1] = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s685268960', 's739784867', 's918245908'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [635, 616, 592] |
p02761 | u805011545 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = np.full(N+1, -1)\nfor i in range(M):\n if(ans[s[i]]==-1):\n ans[s[i]] = c[i]\n elif(ans[s[i]]!=c[i]):\n print(-1)\n sys.exit()\n\nif(ans[1]==0)and(N!=1):\n print(-1)\n sys.exit()\nif(ans[1]==-1)and(n!=1):\n ans[1] = 1\nans = np.where(ans==-1, 0, ans)\nAns = 0\nfor i in range(1, N+1):\n Ans += 10*... | ['Runtime Error', 'Accepted'] | ['s691238947', 's536992412'] | [9164.0, 27200.0] | [30.0, 120.0] | [331, 509] |
p02761 | u813174766 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 time\nn,m=map(int,input().split())\nif m>0:\n time.sleep(2.1)\nelse:\n if n==1:\n print(0)\n elif n==2:\n print(10)\n elif(n==3):\n print(100)', 'n,m=map(int,input().split())\ns=[]\nt=[]\nfor i in range(m):\n u,v=input().split()\n s.append(int(u)-1)\n t.append(v)\nans=-1\nfor i in range(1000):\... | ['Time Limit Exceeded', 'Accepted'] | ['s571831178', 's353461604'] | [3060.0, 3188.0] | [2104.0, 20.0] | [152, 301] |
p02761 | u814271993 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["a,b=map(int, input().split())\ns = [list(map(int, input().split())) for i in range(b)]\ns = sum(s, [])\nL = [-1]*[0]*(a-1)\nans = 0\nab = 10**(a-1)\n\nfor i in range(b):\n if L[s[i*2]-1] == 0:\n L[s[i*2]-1] = s[i*2+1]\n if L[s[i*2]-1] != 0 and L[s[i*2]-1] == s[i*2+1]:\n pass\n if L[s[i*2]-1] !=... | ['Runtime Error', 'Accepted'] | ['s151788735', 's038988498'] | [9228.0, 9128.0] | [30.0, 27.0] | [719, 359] |
p02761 | u814885356 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\ncandidate = [-1]*N\nflag = False\nif N == 1:\n if M == 0:\n candidate = [0]\n else:\n s_temp,c_temp = map(int, input().split())\n candidate = [c_temp]\nelse:\n for i in range(M):\n s_temp,c_temp = map(int, input().split())\n s_temp = s_temp - 1\n if candidate[s_te... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s393477044', 's580286793', 's792211169', 's885688995'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0, 17.0] | [543, 574, 495, 418] |
p02761 | u814986259 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N,M=map(int,input().split())\nd = dict()\nfor i in range(M):\n a,b=map(int,input().split())\n if a not in d:\n d[a]=b\n else:\n if d[a]!=b:\n print(-1)\n exit(0)\ntmp=0\nfor i in range(10):\n if N==3 and i ==0:\n continue\n for j in range(10):\n if N==2 and j ==0:\n continue\n for k... | ['Wrong Answer', 'Accepted'] | ['s521054937', 's779825799'] | [3064.0, 3064.0] | [18.0, 17.0] | [536, 503] |
p02761 | u815763296 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = {}\nansstr = []\nfor _ in range(M):\n S, C = map(int, input().split())\n if S == 1 and C == 0:\n print(\'-1\')\n sys.exit()\n elif S > N:\n print(\'-1\')\n sys.exit()\n elif S in ans:\n if ans[S] != C:\n prin... | ['Wrong Answer', 'Accepted'] | ['s248069700', 's826591285'] | [9224.0, 8968.0] | [28.0, 32.0] | [548, 504] |
p02761 | u821775079 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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=[]\nans=-1\nfor i in range(M):\n s_i,c_i=input().split()\n s.append(int(s_i))\n c.append(c_i)\nfor i in range(int("1"+"0"*(N-1)),int("9"*N)+1):\n ans_bool=True\n for j in range(M):\n ans_bool=ans_bool and str(i)[s[j]-1]==str(c[j])\n if ans_bool:\n ... | ['Wrong Answer', 'Accepted'] | ['s443658921', 's828069350'] | [3064.0, 3064.0] | [18.0, 18.0] | [332, 578] |
p02761 | u826785572 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nnum = [-1] * n\n\nfor _ 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 num[s-1] == -1 or num[s-1] == c:\n num[s-1] = c\n else:\n print(-1)\n exit()\n\nfor i in range(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s017568709', 's355421692'] | [3064.0, 3064.0] | [17.0, 17.0] | [437, 495] |
p02761 | u826929627 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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_list = [-1]*(N+1)\n\nfor m in range(M):\n s,c = map(int, input().split())\n \n \n if _list[s] != -1 and _list[s] != c:\n print(-1)\n exit()\n \n else:\n _list[s] = c\n \nans = ''\nfor idx, _ in ennumerate(_list[1:]):\n if _ == -1:\n \n if idx != 0:\n ans... | ['Runtime Error', 'Accepted'] | ['s520391032', 's423568690'] | [3064.0, 3064.0] | [17.0, 20.0] | [535, 617] |
p02761 | u827646026 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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_line = [int(i) for i in input().split(" ")]\nn = input_line[0]\nm = input_line[1]\n\nans = ["1"] + ["0"] * (n - 1)\nflag = 0\nfor i in range(m):\n input_line = input().split(" ")\n if int(input_line[0]) == 1 and flag == 0:\n ans[int(input_line[0]) - 1] = input_line[1]\n flag = 1\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s168667871', 's187786524', 's494733600', 's960157263', 's319576108'] | [3064.0, 3064.0, 3064.0, 3064.0, 3188.0] | [18.0, 17.0, 17.0, 17.0, 17.0] | [694, 483, 723, 734, 779] |
p02761 | u830054172 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\na = [list(map(int, input().split())) for _ in range(m)]\n\nans = [0 for _ in range(n)]\ncheck = [False for _ in range(n)]\n\nflag = 0\n\nfor i, j in a:\n if check[i-1] == 0 or ans[i-1] == j:\n ans[i-1] = j\n check[i-1] = True\n else:\n flag = 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s051425526', 's127078472', 's415239423', 's571725631', 's957428404'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0, 17.0, 18.0] | [463, 464, 532, 464, 524] |
p02761 | u833738197 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 ss,cc = map(int,input().split())\n s.append(ss)\n c.append(cc)\nfor i in range(10**(n-1) if n>1 else 0,10**n):\n ans = str(i)\n for j in range(m):\n if ans[s[j]-1] != str(c[j]):\n break\n else:\n pr... | ['Wrong Answer', 'Accepted'] | ['s776552529', 's253528435'] | [3064.0, 3064.0] | [18.0, 18.0] | [323, 348] |
p02761 | u836737505 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | [',m = map(int, input().split())\nsc = [list(map(int, input().split())) for _ in range(m)]\nfor i in range(1001):\n if m == 0 and n == 1:\n print(0)\n break\n elif m==0:\n print("1"*n)\n break\n\n for j,k in sc:\n if len(str(i)) < j or len(str(i)) != n:\n break\n ... | ['Runtime Error', 'Accepted'] | ['s423109598', 's530773255'] | [2940.0, 3064.0] | [17.0, 20.0] | [419, 288] |
p02761 | u838786721 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nc = [[] for _ in range(n)]\nfor i in range(m):\n s,x = map(int,input().split())\n c[s-1].append(x)\n\nr = 0\nd = [-1 for _ in range(n)]\n\nfor i in range(n):\n if len(set(c[i])) > 1:\n r = -1\n break\n elif len(c[i]) == 0:\n continue\n elif i == 0 an... | ['Wrong Answer', 'Accepted'] | ['s031608366', 's897521376'] | [3064.0, 3064.0] | [18.0, 17.0] | [775, 769] |
p02761 | u840958781 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 ans[s-1]=c\n if c!=0 and ans[s-1]==0:\n ans[s-1]=c \n pans="0"\n else:\n pans="-1"\n \nans = [str(i) for i in ans]\nif pans != "-1":\n pans="".join(ans)\n if pans[0]=="0":... | ['Runtime Error', 'Accepted'] | ['s264648785', 's541956254'] | [3064.0, 3064.0] | [17.0, 17.0] | [344, 540] |
p02761 | u841599623 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [0]*N\nSC = []\nERROR = False\nfor _ in range(M):\n sc = list(map(int, input().split()))\n SC.append(sc)\nfor i in range(len(SC)-1):\n for j in range(i+1,len(SC)):\n print(SC[i][0], SC[i][1], SC[j][0], SC[j][1])\n if SC[i][0] == SC[j][0] and SC[i][1] != SC[j][1]:\n ... | ['Wrong Answer', 'Accepted'] | ['s171203914', 's747689190'] | [3064.0, 3064.0] | [17.0, 19.0] | [545, 566] |
p02761 | u842170774 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['f=lambda:map(int,input().split())\nN,M=f()\nq=[list(f()) for _ in [0]*M]\nres=-1\nA=range(10**(N-1),10**N)\nif N==1:A+=[0]\nfor i in :\n for j in range(M):\n if str(i)[q[j][0]-1]!=str(q[j][1]):\n break\n else:\n res=i\n break\nprint(res)', 'f=lambda:map(int,input().split())\nN,M=... | ['Runtime Error', 'Accepted'] | ['s026303458', 's802844900'] | [8920.0, 9148.0] | [26.0, 28.0] | [262, 270] |
p02761 | u842388336 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n, m = map(int, input().split())\ns_li_ = []\nc_li_ = []\n\nfor _ in range(m):\n s, c = map(int, input().split())\n s_li_.append(s)\n c_li_.append(c)\n\ndef func(n, m, s_li, c_li):\n if m==0:\n return -1\n \n if n==1:\n if (s_li[0]==1) & (c_li[0]==0):\n return 0\n \n for i in range(10**(n-1), 10**n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s514936728', 's990043187', 's605120146'] | [9160.0, 9164.0, 9132.0] | [26.0, 26.0, 28.0] | [477, 480, 523] |
p02761 | u845620905 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = ["0"] * N\nb = [False] * N\nansFlag = True\n\nfor i in range(M):\n s, c = map(int, input().split())\n if b[s-1] == True and a[s-1] != str(c):\n ansFlag = False\n\n if s == 1 and c == 0 and N > 1:\n ansFlag = False\n\n if b[s-1] == False:\n b[s-1] ... | ['Wrong Answer', 'Accepted'] | ['s255598940', 's240035616'] | [3188.0, 3064.0] | [18.0, 19.0] | [425, 439] |
p02761 | u848877025 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nsets = []\nfor i in range(M):\n s,c = input().split()\n sets.append((s,c))\n\nstart = 0\nif N != 1:\n start = 10**(N-1)\n\nfor n in range(start,10**N):\n print(n)\n for s,c in sets:\n if str(n)[int(s)-1] == c:\n continue\n else:\n break\n else:\n print(n)\n ... | ['Wrong Answer', 'Accepted'] | ['s477227478', 's713897019'] | [3188.0, 3064.0] | [18.0, 18.0] | [324, 313] |
p02761 | u851319680 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [[0 for i in range(10)]for l in range(N)]\nans = ''\nend = False\nfor l in L:\n if l[0] == 1 & l[1] == 0:\n print(-1)\n end = True\n break\n else:\n A[l[0]-1][l[1]] = 1\nif not end:\n if any(sum(a) > 1 for a in A):\n print(-1)\n else:\n for i in range(N):\n ... | ['Runtime Error', 'Accepted'] | ['s714558822', 's860179526'] | [3064.0, 3064.0] | [18.0, 18.0] | [621, 450] |
p02761 | u852386636 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\n\ndic = {}\nfor i in range(N):\n dic[i] = 0\n\n\ndic2= {}\nfor i in sc:\n if i[1] != 0:\n if (i[0]-1 not in dic2.keys()):\n dic2[i[0]-1] = i[1]\n elif i[0]-1 in dic2.keys():\n dic2... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s127207255', 's403478303', 's587451952'] | [9128.0, 9144.0, 9240.0] | [26.0, 26.0, 32.0] | [1, 485, 648] |
p02761 | u852798899 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [list(map(int, input().split())) for _ in range(m)]\n\nfor i in range(10**(n-1), 10**n):\n tmp = str(i)\n for s, c in digit:\n if tmp[s-1] != c:\n continue\n print(i)\n exit()\nprint(-1)\n \n', 'n, m = map(int, input().split())\n\ntmp = ["0" for i in range(n)]\nc... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s385556745', 's494384092', 's776844601', 's783107350', 's228744473'] | [2940.0, 3064.0, 3060.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0, 17.0, 18.0] | [234, 344, 291, 813, 309] |
p02761 | u853547292 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m = map(int,input().split())\nd = dict()\nfor i in range(m):\n k,v = map(int,input().split())\n if k in d:\n if d[k] !=v:\n print(-1)\n exit()\n else:\n d[k] = v\nres = ""\nfor i in (1,n+1):\n if i not in d:\n d[i] = 0\n res += str(d[i])\nres = int(res)\nif ... | ['Wrong Answer', 'Accepted'] | ['s785380294', 's597402681'] | [3064.0, 3064.0] | [17.0, 17.0] | [347, 811] |
p02761 | u853952087 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["n,m=map(int,input().split())\n\np = [[int(i) for i in input().split()] for _ in range(m)]\n\np.append([0,10])\n\np.sort(key=lambda x:(x[0],x[1]))\n\nA=[]\n\na=0\n\nfor i in range(m): \n if p[i][0]==p[i+1][0] and not(p[i][1]==p[i+1][1]):\n print(-1) \n a=1\n break\n elif not(p[i][0]==p[i... | ['Wrong Answer', 'Accepted'] | ['s008386941', 's447340326'] | [3064.0, 3064.0] | [17.0, 18.0] | [646, 783] |
p02761 | u854685063 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nimport itertools as it\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():retu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s139315375', 's641732197', 's767792954'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [966, 812, 985] |
p02761 | u854992222 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nflg = [0] * n\nans = [0] * n\n\nfor i in range(m):\n if flg[s[i]-1] == 0:\n ans[s[i]-1] = c[i]\n flg[s[i]-1] = 1\n elif flg[s[i]-1] != 0 and ans[s[i]-1] != c[i]:\n ... | ['Wrong Answer', 'Accepted'] | ['s551435916', 's326662149'] | [9208.0, 9144.0] | [30.0, 29.0] | [569, 306] |
p02761 | u856775981 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nans = 10 ** n\nnum = [-1] * n\n\nfor i in range(m):\n s, c = list(map(int, input().split()))\n if num[s - 1] == -1:\n num[s - 1] = c\n elif num[s - 1] != c:\n ans = -1\n break\n\nif ans != -1:\n \n if n == 1:\n ans = num[0]\n \n ... | ['Wrong Answer', 'Accepted'] | ['s026642047', 's735133114'] | [9156.0, 9144.0] | [28.0, 28.0] | [728, 847] |
p02761 | u857293613 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nlis = [list(map(int, input().split())) for _ in range(m)]\nans = -1\ni = 10**(n-1)\nwhile (ans == -1) and (i < 10**n):\n s = 0\n for j in lis:\n if str(i)[j[0]-1] == str(j[1]):\n s += 1\n else:\n s += 0\n if s == m:\n an... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s584133208', 's701319804', 's790631396'] | [3064.0, 3188.0, 3064.0] | [18.0, 19.0, 19.0] | [361, 357, 345] |
p02761 | u857346974 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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()))\nx = []\nans = [0]*m\nansw = 0\ns,c = [], []\n\ndef has_duplicates(seq):\n return len(seq) != len(set(seq))\n\nfor i in range(m):\n x.append(list(map(int,input().split())))\n \n\nx = list(map(list, set(map(tuple, x))))\n\nfor i,j in x:\n s.append(i)\n c.append(j)\n \n\nif... | ['Runtime Error', 'Accepted'] | ['s687467634', 's344122267'] | [3064.0, 3064.0] | [18.0, 18.0] | [584, 765] |
p02761 | u860002137 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nfrom collections import defaultdict\n\nn, m = map(int, input().split())\ntmp = [0] * n\nmemo = defaultdict(int)\n\nfor i in range(m):\n s, c = map(int, input().split())\n if i==0:\n memo[s] = c\n elif s in memo & memo[s]!=c:\n print(-1)\n sys.exit()\n elif (n==3 & s==1 & c... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s278117168', 's305550610', 's789791429', 's048306055'] | [3316.0, 2940.0, 3316.0, 9228.0] | [20.0, 17.0, 21.0, 30.0] | [433, 794, 466, 502] |
p02761 | u861071267 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["import sys\nN,M = map(int,input().split())\nsc = [list(map(int,input().split())) for i in range(M)]\n\nans = ['-1'] * N\n\nfor i in range(M):\n if ans[sc[i][0]-1] == sc[i][1]:\n continue\n elif ans[sc[i][0]-1] == '-1':\n ans[sc[i][0]-1] = sc[i][1]\n else:\n print('-1')\n sys.exit(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s367501019', 's636898703', 's548804257'] | [3064.0, 3064.0, 3064.0] | [19.0, 18.0, 19.0] | [563, 790, 610] |
p02761 | u861886710 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nfor X in range(10**N):\n X = str(X)\n \n \n if len(X) == N and all(X[s-1] == str(c) for s, c in SC):\n print(X[s-1])\n break\nelse:\n print(-1)', 'N, M = map(int, input().split())\nSC = [list(map(int, input().spli... | ['Runtime Error', 'Accepted'] | ['s301125003', 's542280071'] | [9200.0, 9188.0] | [25.0, 29.0] | [281, 277] |
p02761 | u863370423 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 f():\n n, m = list(map(int, input().split()))\n a = [-1, -1, -1, -1]\n\n for c in range(m):\n x = list(map(int, input().split()))\n if(a[x[0]] == -1):\n a[x[0]] = x[1]\n else:\n if(a[x[0]] != x[1]):\n return -1\n for y in range(4):\n if(a[y] == -1):\n a[y] = 1\n #print(a)\n ... | ['Wrong Answer', 'Accepted'] | ['s277766804', 's058584106'] | [3064.0, 3064.0] | [18.0, 17.0] | [501, 438] |
p02761 | u863964720 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nSi = []\nCi = []\ncheck1 = 0\ncheck2 = 0\ncheck3 = 0\nlastcheck = 0\nsum = 0\nfor i in range(M):\n S,C = map(int, input().split())\n Si.append(S)\n Ci.append(C)\nif N==1:\n for i in range (M):\n sum +=C[i]\n check3 = i\n if C[i] != C[check3]:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s678129049', 's706723960', 's914319949', 's103708793'] | [3192.0, 3192.0, 3316.0, 3192.0] | [17.0, 18.0, 18.0, 18.0] | [1111, 1847, 1885, 1982] |
p02761 | u865119809 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nrest = []\nfor i in range(m):\n a,b = input().split()\n rest.apend((int(a),b))\n\ndone = False\n\nfor i in range(0,1000):\n x = str(i)\n if (len(x) == n):\n ok = True\n for t in rest:\n if (x[t[0] - 1] != t[1]):\n ok = False\n ... | ['Runtime Error', 'Accepted'] | ['s318309977', 's816326684'] | [3188.0, 3064.0] | [18.0, 18.0] | [405, 424] |
p02761 | u865383026 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [str(i) for i in range(1 * 10 ** (N - 1), 1 * 10 ** N)]\nif N == 1:\n A.append('0')\nfor i in range(M):\n t = list(map(int, input().split()))\n A = [A[j] for j in range(len(A)) if int(A[j][t[0] - 1]) == t[1]]\nprint(-1 if not A == True else min(A))", "N, M = map(int, input().s... | ['Wrong Answer', 'Accepted'] | ['s566634696', 's116014919'] | [3064.0, 3064.0] | [18.0, 18.0] | [282, 284] |
p02761 | u867826040 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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)]\nl = [0]*n\nfor t in sc:\n l[t[0]-1] = t[1]\nif sc[0][0]!=1 and sc[0][1]==0:\n l[0]=1\n print("".join([str(s) for s in l]))\nelse:\n if l[0]==0:\n print(-1)', 'n,m = map(int,input().split())\nx = [tuple(map(int... | ['Runtime Error', 'Accepted'] | ['s604777685', 's345024960'] | [3064.0, 3064.0] | [18.0, 18.0] | [254, 280] |
p02761 | u867848444 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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=set(tuple(map(int,input().split())) for i in range(m))\n\nS=['1']+['0']*(n-1)\nfor s,c in sc:\n if s==1 and c==0 and n>1:\n print(-1)\n exit()\n elif n>1 and S[0]!='1':\n print(-1)\n exit()\n elif s>1 and S[s-1]!='0':\n print(-1)\n ex... | ['Wrong Answer', 'Accepted'] | ['s273159426', 's149174613'] | [3064.0, 3064.0] | [17.0, 17.0] | [381, 382] |
p02761 | u868606077 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nlines = sys.stdin.readlines()\nline1 = lines.pop(0).split(' ')\n#print(line1)\nN = int(line1[0])\nM = int(line1[1])\n\n#print(N)\n#print(M)\n\nstr = [0] * N\nans = []\nflg = 0\nfor i in range(M):\n line = lines.pop(0).split(' ')\n# print(line)\n s = int(line[0])\n c = int(line[1])\n# print(s)\n# pri... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s042685981', 's366677139', 's426139461', 's656441257', 's784265606', 's156123811'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0, 18.0, 18.0, 18.0] | [982, 675, 956, 597, 1384, 1211] |
p02761 | u870518235 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['lst = []\n\nfor i in range(10):\n for j in range(10):\n for k in range(10):\n lst.append(str(i)+str(j)+str(k))\n\nN, M = map(int, input().split())\nS = []\nC = []\nfor l in range(M):\n S.append(0)\n C.append(0)\n S[l], C[l] = map(int, input().split())\n C[l] = str(C[l])\n\nfor n in ra... | ['Runtime Error', 'Accepted'] | ['s151682156', 's250346449'] | [3064.0, 9244.0] | [19.0, 30.0] | [486, 902] |
p02761 | u870559097 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nZ = [None for _ in range(N)]\nfor i in range(M):\n s, c = map(int, input().split())\n if Z[s-1] == None or Z[s-1] == c:\n Z[s-1] = c\n else:\n print(-1)\n break\nelse:\n if Z[0] == 0:\n print(-1)\n elif Z[0] == None:\n Z[0] = 1\n for l in range(N):\n if Z[... | ['Wrong Answer', 'Accepted'] | ['s599042424', 's639389623'] | [3064.0, 3064.0] | [17.0, 17.0] | [363, 521] |
p02761 | u872538555 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n, m = map(int, input().split())\n\nif 0 < m:\n s_c = [0] * (m * 2)\n for i in range(m):\n s_c[2 * i], s[2 * i + 1] = map(int, input().split())\n \n\nfor i in range(0, m * 2 , 2):\n s_c[i] -= 1\n\nnum = [-1] * n\nflag = False\nfor i in range(m):\n if num[s_c[2 * i]] != -1 and num[s_c[2 * i]] != ... | ['Runtime Error', 'Accepted'] | ['s088989230', 's074571367'] | [3064.0, 3064.0] | [17.0, 17.0] | [649, 561] |
p02761 | u876536031 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nS = [""]*N\nfor _ in range(M):\n s, c = map(int,input().split())\n else:\n if S[s-1] == "" or S[s-1] == c:\n S[s-1] = c\n elif S[s-1] != "" and S[s-1] != c:\n print(-1)\n exit(0)\nif N == 3:\n if S[0] == "":\n S[0] = 1\n if S[0] = 0:\n print(-1)... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s884630089', 's949424197', 's279649459'] | [2940.0, 2940.0, 3064.0] | [18.0, 17.0, 17.0] | [632, 955, 543] |
p02761 | u878129968 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n, m = map(int, input().split())\n\ndigit = [None] * n\nfor ind in range(m):\n s, c = map(int, input().split())\n if digit[s-1] == None:\n digit[s-1] = c\n elif digit[s-1] != c:\n print("-1")\n exit()\nprint(digit)\nif n > 1 and digit[0] == 0:\n print("-1")\n exit()\nnums = [0] * n\nfor ind, num in enum... | ['Wrong Answer', 'Accepted'] | ['s831870551', 's511403055'] | [3064.0, 3064.0] | [17.0, 17.0] | [493, 535] |
p02761 | u879294842 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 sc = {}\n N,M = map(int,input().split())\n for _ in range(M):\n s,c = input().split()\n s = int(s)\n if s not in sc:\n sc[s] = c\n return -1\n else:\n if sc[s] != c:\n return -1\n\n if 1 in sc and sc[1] == 0 and N !=... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s202770361', 's795692007', 's906823634', 's582218170'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0, 17.0] | [578, 585, 580, 558] |
p02761 | u880480312 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nt = [-1]*N\nfor i in range(M):\n s, c=map(int, input().split())\n s -= 1\n if t[s] != c:\n print(-1)\n exit()\n t[s] = c\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 i... | ['Wrong Answer', 'Accepted'] | ['s181973591', 's049484940'] | [3188.0, 3064.0] | [18.0, 17.0] | [415, 430] |
p02761 | u881116515 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m = map(int,input().split())\na = [-1 for i in range(n)]\nans = True\nfor i in range(m):\n s,c = map(int,input().split())\n s -= 1\n if (n != 1 and s == 0 and c == 0) or (a[s] != -1 and a[s] != c):\n ans = False\n print(-1)\n break\n else:\n a[s] = c\nif ans:\n for i in range(n):\n if a[i] == -1... | ['Wrong Answer', 'Accepted'] | ['s061078759', 's144175926'] | [3064.0, 3064.0] | [17.0, 17.0] | [361, 434] |
p02761 | u884323674 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(i) for i in input().split()] for j in range(M)]\n\nnum_min = 10**(N-1)\nnum_max = 10**N\nif N > 1:\n i = num_min\nelse:\n i = 0\nans = -1\nwhile i < num_max:\n num_list = []\n rem = i\n for j in range(N, 0, -1):\n num_list.append(rem // 10**(j-1))\n ... | ['Wrong Answer', 'Accepted'] | ['s329203965', 's877047171'] | [3064.0, 3064.0] | [21.0, 20.0] | [553, 537] |
p02761 | u884601206 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 n==1:\n for i in range(10):\n \n flg=True\n for l in range(m):\n if str(i)[b[l][0]-1] != str(b[l][1]):\n flg=False\n if flg==True:\n print(i)\n break\n else:\n print(-1)\n \nelse: \n for i in range(10**(n-1),10**n):\n flg=True\n for j in range(m):\n if str(i)[b... | ['Runtime Error', 'Accepted'] | ['s423643510', 's115356327'] | [3064.0, 3064.0] | [18.0, 20.0] | [435, 519] |
p02761 | u886142147 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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()))\ntable = [input().split() for l in range(M)]\nans = 0\narray1 = []\narray2 = []\narray3 = []\nketa1 = -1\nketa2 = -1\nketa3 = -1\ns1 = 0\ns2 = 0\ns3 = 0\nfor k in range(M):\n for j in range(2):\n table[k][j] = int(table[k][j])\n\nfor k in range(M):\n if table[k][0] == 1:... | ['Wrong Answer', 'Accepted'] | ['s264529439', 's226201576'] | [3064.0, 3064.0] | [17.0, 18.0] | [1070, 367] |
p02761 | u886459614 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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={}\nswitch = 0\nans = 0\n\n\nfor i in range(m):\n\ta, b = map(int, input().split())\n\tif a in D:\n\t\tfor s in D:\n\t\t\tif a == s and b != D[s]:\n\t\t\t\tprint('-1')\n\t\t\t\tswitch+=1\n\t\t\t\tbreak\n\telse:\n\t\tD[a]=b\nfor a in D:\n\tans+=D[a]*10**(n-a)\nprint(ans)\n\nif switc... | ['Wrong Answer', 'Accepted'] | ['s328629701', 's693280058'] | [3064.0, 3064.0] | [17.0, 17.0] | [492, 663] |
p02761 | u886655280 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [0] * N\nN_set_list = [False] * N\n\nfor i in range(M):\n s, c = map(int, input().split())\n s -= 1\n \n if s > N -1 or (s == 0 and c == 0):\n print(-1)\n exit()\n\n elif N_set_list[s] and (N_list[s] != c):\n print(-1)\n exit()\n\n else:\n N_list[s] = c\... | ['Runtime Error', 'Accepted'] | ['s866501495', 's331209944'] | [3064.0, 3064.0] | [18.0, 18.0] | [416, 418] |
p02761 | u888881904 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nfor i in range(1000):\n ans = str(i)\n for s, c in sc:\n print(s, c, ans)\n if int(ans[s-1]) != c:\n break\n else:\n print(ans)\n exit()\n\nprint(-1)', 'n, m = map(int, input()... | ['Runtime Error', 'Accepted'] | ['s206551097', 's294595228'] | [3572.0, 3064.0] | [20.0, 18.0] | [278, 292] |
p02761 | u892340697 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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()\ns,c,a = [],[],[]\nnumber = []\nfor i in range(int(M)):\n a_i = input().split()\n a.append(a_i)\n s.append(int(a_i[0]))\n c.append(int(a_i[1]))\nans = True\nfor i in range(int(N)):\n number.append('')\nfor i in range(int(M)):\n if (s[i]==1 and c[i]==0 and int(N)>1) or s[i] > N:... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s103384125', 's458950338', 's689261192', 's943149769'] | [3064.0, 3064.0, 3064.0, 3192.0] | [18.0, 17.0, 18.0, 17.0] | [753, 608, 822, 840] |
p02761 | u895408600 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N,M=map(int,input().split())\nsc=[list(map(int,input().split())) for i in range(M)]\ns=[sc[i][0] for i in range(M)]\nc=[sc[i][1] for i in range(M)]\nsc.sort()\nif N==1:\n if 2 in s or 3 in s:\n ans=-1\n else:\n ans=sc[0][1]\nif N==2:\n if 3 in s:\n ans=-1\n else:\n if sc[0][0]=... | ['Runtime Error', 'Accepted'] | ['s210795034', 's675041022'] | [3064.0, 3064.0] | [18.0, 18.0] | [813, 358] |
p02761 | u896941378 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 fractions import gcd\nfrom collections import Counter, deque, defaultdict\nfrom heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge\nfrom bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort\nfrom itertools import product, combinations,permutations\nfrom copy im... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s283416939', 's460399115', 's515841590', 's678891972', 's850293769', 's860786793', 's893421242', 's937679104', 's128346419'] | [10420.0, 10580.0, 10592.0, 10544.0, 10500.0, 9160.0, 10460.0, 9216.0, 9092.0] | [40.0, 39.0, 44.0, 39.0, 39.0, 27.0, 39.0, 30.0, 31.0] | [885, 963, 890, 890, 966, 468, 883, 468, 497] |
p02761 | u899308536 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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"""\nN=1 0~9\nN=2 10~99\nN=3 100~999\nN 10**(N-1)~10**N-1\n"""\nS = []\nC = []\nfor i in range(M):\n s,c = list(map(int,input().split()))\n S.append(s)\n C.append(c)\n\n# print(S)\n# print(C)\n\ny = 10**N\n\nif N == 1:\n L,R = 0,10\nelif N == 2:\n L,R = 10,100\ne... | ['Wrong Answer', 'Accepted'] | ['s914105041', 's875233395'] | [3188.0, 3064.0] | [19.0, 19.0] | [585, 587] |
p02761 | u899953001 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 python\n\ndef func():\n n,m = [int(i) for i in input().split(" ")]\n pibot = 10**(m-1)\n dic = {}\n\n for i in range(m):\n tmp = [int(i) for i in input().split(" ")]\n\n if tmp[0] not in dic.keys():\n dic[tmp[0]] = tmp[1]\n else:\n if dic[tmp[0]] !... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s103543937', 's120505357', 's291744946', 's360133745', 's495666224', 's813423688', 's075569125'] | [3064.0, 3064.0, 3064.0, 3188.0, 3188.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0, 19.0, 20.0, 17.0, 18.0] | [660, 705, 586, 554, 648, 641, 502] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.