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 | u218838821 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 new = list(map(int,input().split()))\n if i != 0:\n for j in range(len(sc)):\n if new[0] == sc[j][0]:\n if new[1] != sc[j][1]:\n print(-1)\n exit()\n else:\n break\n else:\n if j == len(sc)-1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s694918182', 's736534427', 's107946598'] | [9240.0, 9200.0, 9248.0] | [27.0, 31.0, 29.0] | [489, 460, 684] |
p02761 | u221537793 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\nsc = [tuple(map(int, input().split())) for _ in range(M)]\ndef cands(N):\n if N ==1:\n return range(10)\n else:\n return range(10 ** (N-1), 10 **N)\n\ndef main(N, sc):\n nums = cands(N)\n print(nums)\n for n in nums:\n try:\n for s,c in ... | ['Wrong Answer', 'Accepted'] | ['s989788800', 's364871221'] | [3064.0, 3064.0] | [18.0, 19.0] | [475, 459] |
p02761 | u221580805 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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_list = []\nc_list = []\nfor _ in range(m):\n s, c = map(int, input().split())\n s_list.append(s)\n c_list.append(c)\nans = ["1"]\nans.extend(["0"]*(n-1))\n\nif m == 1:\n if s_list[0] == 1:\n ans = [str(c_list[0])]\n else:\n ans[s_list[0]-1] = str(c_list[0])\nelif c_lis... | ['Runtime Error', 'Accepted'] | ['s967351203', 's052437316'] | [3064.0, 3060.0] | [18.0, 18.0] | [544, 321] |
p02761 | u222668979 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 _ in range(m)]\n\nans = [-1] * n\nfor i in sc:\n s,c=sc[i]\n if (ans[s-1] == c) | (ans[s-1] == -1):\n ans[s-1] = c\n else:\n print(-1)\n sys.exit()\n\nfor i in range(n):\n if ans[i] == -1:\n ... | ['Runtime Error', 'Accepted'] | ['s714949979', 's051233060'] | [3064.0, 9180.0] | [17.0, 29.0] | [465, 436] |
p02761 | u225020286 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nguess=["0"]*N\nfor i in sc:\n guess[i[0]-1]=i[1]\nif guess[0]==0:\n print("-1")\nelse:\n for i in guess:\n print(i,end="")\n', 'N,M=map(int,input().split())\nS=[]\nC=[]\nfor i in range(M):\n s1,c1=[int(i) for i in input().spli... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s095847813', 's121014418', 's212682223', 's262929141', 's267819644', 's288813416', 's377399004', 's634916116', 's786555916', 's811366639', 's927283796'] | [3060.0, 3064.0, 3064.0, 3060.0, 3064.0, 3064.0, 3064.0, 3064.0, 3060.0, 3060.0, 3064.0] | [18.0, 27.0, 20.0, 17.0, 18.0, 24.0, 17.0, 17.0, 19.0, 17.0, 18.0] | [205, 266, 254, 234, 235, 300, 233, 260, 237, 208, 259] |
p02761 | u225845681 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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, *sc = map(int, open(0).read().split())\ns=[]\nc=[]\nfor i in range(2*M):\n if i%2 == 0:\n s.append(sc[i])\n else:\n c.append(sc[i])\n\nans = 0\n\nfor j in range(M):\n if N == 2 and s[j] == 1 and c[j] == 0:\n ans = -1\n break\n elif N == 3 and s[j] == 1 and c[j] == 0:\n ans = -1\n break\n\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s540411581', 's823535501', 's877705830'] | [3064.0, 3064.0, 3192.0] | [18.0, 17.0, 18.0] | [720, 707, 711] |
p02761 | u230621983 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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())\ntmp = [10]*n\n\nfor _ in range(m):\n s,c = map(int, input().split())\n tmp[s-1] = min(tmp[s-1],c)\nfor i in range(n):\n if tmp[i] == 10:\n tmp[i] = 0\n\nans = ''.join(map(str,tmp))\nif ans[0] == '0':\n print('-1')\nelse:\n print(num)", "n, m = map(int, input().s... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s180633375', 's809002362', 's763863544'] | [3064.0, 3064.0, 3192.0] | [18.0, 17.0, 18.0] | [275, 417, 432] |
p02761 | u232873434 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nanswer = ['0']* N\ns_list = []\nc_list = []\nend = 0\nfor i in range(0,M):\n s, c = map(int, input().split())\n answer[s-1]= str(c)\n s_list.append(s)\n c_list.append(c)\n for i in range(0,len(s_list)):\n if (s_list[i] == s) & (c_list[i] != c):\n en... | ['Wrong Answer', 'Accepted'] | ['s626165726', 's322145465'] | [3064.0, 3064.0] | [17.0, 17.0] | [564, 558] |
p02761 | u235027735 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\na = [[],[],[]]\nfor i in range(m):\n s, c = map(int, input().split())\n if not c in a[s-1]:\n a[s-1].append(c)\n \nans = 0\nif m==0:\n if n==3:\n print(100)\n elif n==2:\n print(10)\n else :\n print(0)\nelif (len(a[0]) > 1) or (len(a[... | ['Runtime Error', 'Accepted'] | ['s016885867', 's731591138'] | [3064.0, 3064.0] | [18.0, 17.0] | [592, 613] |
p02761 | u237299453 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\nif max(s) > n:\n print("-1")\n exit()\nk1 = [100, 10, 1]\nan =[]\nzeros =[]\nfor i in range(m):\n if c[i] == 0:\n zeros.append(s[i])\n an.append(c[i] * k1[s[i] - 1])\n\nfor i in range(m):\n fo... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s819294277', 's987986006', 's907186410'] | [9276.0, 9140.0, 9168.0] | [27.0, 26.0, 29.0] | [610, 574, 413] |
p02761 | u238084414 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nans = 0\nexist = False\nif N == 1:\n x = 0\nelse:\n x = 10 ** (N - 1)\nfor i in range(x, 1000):\n s = str(i)\n f = True\n for j in range(M):\n print(i, sc[j][0], sc[j][1], s[sc[j][0] - 1])\n if int(s[sc[j][0] - 1]) ... | ['Wrong Answer', 'Accepted'] | ['s935529257', 's567335804'] | [3572.0, 3064.0] | [21.0, 18.0] | [420, 370] |
p02761 | u238504302 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 sc = list(list(input().split()) for _ in range(M))\n\n li = [""] * N\n\n for i in range(M):\n j = li[int(sc[i][0]) - 1]\n if j == "": li[int(sc[i][0]) - 1] = sc[i][1]\n elif j != sc[i][1]: return -1\n\n for i in range(N):\n if i == 0:\n if li[0] ==... | ['Runtime Error', 'Accepted'] | ['s833291822', 's826100545'] | [8912.0, 9084.0] | [26.0, 31.0] | [481, 481] |
p02761 | u238940874 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nstart=10**(n-1)\nend=10**n\nif n == 1:\n start = 0\nfor i in range(start,end):\n i=str(i)\n for s,c in sc:\n if i[s-1] != str(c):\n break\n else:\n print(i)\n break\nprint(-1)', 'n,m=map(in... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s772303867', 's848960606', 's181931696'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [290, 246, 280] |
p02761 | u239528020 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['# C\nN, M = list(map(int, input().split()))\n\nflag = 0\nans = [0]*M\nans_flag = [0]*M\n\nsc = [list(map(int, input().split())) for _ in range(M)]\nfor i in range(M):\n s, c = sc[i]\n if ans_flag[s-1] == 1:\n if ans[s-1] != c:\n flag = 1\n break\n ans_flag[s-1] = 1\n ans[s-1] ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s173880974', 's867641332', 's758251216'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [485, 516, 618] |
p02761 | u239653493 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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,c = map(int, input().split())\nd,e,f = map(int, input().split())\ng,h,i = map(int, input().split())\nn=int(input())\nA = []\nfor i in range(n):\n A.append(int(input()))\nif (a in A) and (b in A) and (c in A):\n print("Yes")\nelif d in A and e in A and f in A:\n print("Yes")\nelif g in A and h in A and... | ['Runtime Error', 'Accepted'] | ['s517828088', 's342787770'] | [3064.0, 3064.0] | [17.0, 19.0] | [614, 665] |
p02761 | u239917977 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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,c=[],[]\n for i in range(M):\n si,ci = map(int, input().split())\n s.append(si)\n c.append(ci)\n \n res=[0]*N\n for si,ci in zip(s,c):\n if res[si-1]== 0:\n res[si-1]=str(ci)\t\n elif res[si-1]!= str(ci):\n print(-1)\n exit()\n \n ... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s093885543', 's224007200', 's292768372', 's910579600'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 18.0] | [487, 593, 591, 634] |
p02761 | u241159583 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\nsc = [list(map(int, input().split())) for _ in range(M)]\n\nans = ["0"] * N\nif N > 1: ans[0] = "1"\nrep = {}\nok = True\n\nfor s,c in sc:\n ans[s-1] = str(c)\n if s in rep and rep[s] != str(c):\n ok = False\n break\n else:\n rep[s] = c\n\nif ok and ans[0] == "0" and N > ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s047375114', 's506530287', 's820114563'] | [3064.0, 3064.0, 9140.0] | [17.0, 18.0, 31.0] | [360, 352, 454] |
p02761 | u242031676 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['#!/usr/bin/env python3\n', '#!/usr/bin/env python3\n', 'n, m = map(int, input().split())\nsc = [list(map(int, input().split())) for i in range(m)]\n\nfor i in range(1000):\n x = str(i)\n if len(x)!=n: continue\n can = 1\n for s,c in sc:\n if int(x[s-1])!=c: can = 0\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s009968548', 's187182184', 's198200016'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 18.0] | [23, 23, 323] |
p02761 | u242580186 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 time\nimport math\nimport itertools as it\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN, M = inpl()\ndp = [-1] * N\nfor _ in range(M):\n s, c = inpl()\n s -= 1\n if dp[s] not in [-1, c]:\n print(-1)\n ... | ['Runtime Error', 'Accepted'] | ['s082421352', 's675097874'] | [8952.0, 9204.0] | [28.0, 28.0] | [940, 941] |
p02761 | u247680229 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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()))\ns=[list(map(int,input().split())) for i in range(M)]\n\nNum=0\nA=[]\nB=[]\nC=[]\n \nif N==3:\n for i in s:\n if i[0]==1:\n A.append(i[1])\n \n elif i[0]==2:\n B.append(i[1])\n \n elif i[0]==3:\n C... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s386587980', 's650412046', 's170703757'] | [3064.0, 3064.0, 3064.0] | [20.0, 17.0, 18.0] | [1176, 1513, 868] |
p02761 | u247830763 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nls = [list(map(int,input().split())) for i in range(m)]\na = []\nb = [0 for m in range(n)]\nprint(b)\nfor q in range(m):\n if ls[q][0] == 1:\n print("Hi")\n if ls[q][1] == 0:\n if n != 1:\n print(-1)\n sys.exit()\n ... | ['Wrong Answer', 'Accepted'] | ['s346191054', 's816468628'] | [3064.0, 3064.0] | [17.0, 17.0] | [737, 606] |
p02761 | u248670337 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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="a"*n\nfor _ in range(m):\n s,c=map(int,input().split())\n s-=1\n if (s==0 and c==0) or (N[s]!="a" and N[s]!=str(c)):\n print(-1)\n exit() \n else:\n N=N[:s]+str(c)+N[s+1:]\nprint(N)\nif N[0]=="a":N="1"+N[1:]\nN=N.replace("a","0")\nprint(int(N))'... | ['Wrong Answer', 'Accepted'] | ['s514319354', 's484487976'] | [3064.0, 3064.0] | [17.0, 17.0] | [304, 313] |
p02761 | u250583425 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["import sys\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n N, M = map(int, input().split())\n sc = [tuple(map(int, input().split())) for _ in range(M)]\n ans = [-1] * N\n for i in range(N):\n for s, c in sc:\n if s == i + 1:\n if ans[i] == -1:\n ... | ['Wrong Answer', 'Accepted'] | ['s433485219', 's310279524'] | [3064.0, 3064.0] | [18.0, 17.0] | [704, 816] |
p02761 | u252828980 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nlia,lib = [],[]\nflag = True\n\nfor i in range(m):\n a,b = map(int,input().split())\n lia.append(a-1)\n lib.append(b)\n#print(lia,lib)\nfor i in range(len(lia)):\n if L[i] == -1:\n L[lia[i]] = lib[i]\n if L[i] != -1:\n print(-1)\n exit()\... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s573637431', 's635111560', 's712997879', 's590470717'] | [3064.0, 2940.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 18.0] | [565, 558, 468, 392] |
p02761 | u253799217 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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(' ')))\nr = [ None for i in range(N) ]\nduplicated = False\nfor i in range(M):\n s, c = list(map(int, input().split(' ')))\n if r[s-1] is not None:\n\tduplicated = True\n break\n r[s-1] = c\n\nif duplicated:\n for i in range(N):\n if r[i] is None:\n r[i] = 0\n v = su... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s056754975', 's101270589', 's173064155', 's329655341', 's348431645', 's361885681', 's659920813', 's688476805', 's707896696', 's867063467', 's776686176'] | [2940.0, 3064.0, 3064.0, 2940.0, 2940.0, 2940.0, 3192.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0] | [366, 486, 410, 370, 383, 585, 475, 404, 427, 387, 492] |
p02761 | u254221913 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nans = [0] * n\nflg = [0] * n\nfor i in range(m):\n s[i],c[i] = map(int,input().split())\nfor j in range(m):\n if: flg[s[j]-1] == 1 and ans[s[j]-1] != c[j]:\n print(-1)\n exit()\n else:\n ans[s[j]-1] = c[j]\n flg[s[j]-1] = 1... | ['Runtime Error', 'Accepted'] | ['s619900337', 's867584896'] | [2940.0, 3064.0] | [17.0, 17.0] | [391, 492] |
p02761 | u254871849 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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, *sc = map(int, sys.stdin.read().split())\nsc = zip(*[iter(sc)] * 2)\n\ndef main():\n res = [0] * n\n determined = set() \n\n for s, c in sc:\n if s in determined:\n return -1\n else:\n res[s-1] = c\n determined.add(s)\n\n if not res[0]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s135722667', 's562584079', 's149083038'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [434, 483, 433] |
p02761 | u255821449 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['# -*- coding: utf-8 -*-\n\nN, M = map(int, input().split())\nresult = [-1] * N\n\nif M == 0:\n\n\nfor i in range(1, M + 1):\n s, c = map(int, input().split())\n if result[s - 1] == -1:\n result[s - 1] = c\n elif result[s - 1] == c:\n continue\n else:\n print(-1)\n exit(0)\n\nif... | ['Runtime Error', 'Accepted'] | ['s438876167', 's792542787'] | [3064.0, 3064.0] | [19.0, 17.0] | [591, 578] |
p02761 | u265506056 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(0)', 'print(-1)', 'N,M=map(int,input().split())\nans=[0]*N\nguess=0\nnum=0\nS=[]\nC=[]\nfor _ in range(M):\n s,c=map(int,input().split())\n S.append(s)\n C.append(c)\nfor i in range(M):\n s=S[i]\n c=C[i]\n if ans[s-1]!=0 and ans[s-1]!=c:\n guess=1\n break\n elif s==1 and c==0:... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s697938790', 's902291722', 's962863647'] | [2940.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0] | [8, 9, 522] |
p02761 | u267300160 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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())\nvalues = []\nfor i in range(N):\n values.append([])\nfor i in range(M):\n s,c = map(int,input().split())\n values[s-1].append(c)\nfor i in range(N):\n if values[i] == list():\n if N == 2:\n values[0].append(1)\n elif N == 3:\n values[0].a... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s055151637', 's516697409', 's616755875'] | [3064.0, 3060.0, 3064.0] | [18.0, 17.0, 19.0] | [847, 251, 1028] |
p02761 | u267718666 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nD = {}\nans = ['0'] * N\nans[0] = '1'\nfor i in range(M):\n if SC[i][0] not in D:\n D[SC[i][0]] = SC[i][1]\n else:\n if D[SC[i][0]] != SC[i][1]:\n print(-1)\n exit()\n\nfor k, v in D.i... | ['Runtime Error', 'Accepted'] | ['s143956570', 's590578778'] | [9056.0, 9120.0] | [24.0, 29.0] | [395, 271] |
p02761 | u268318377 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n, m = map(int, input().split())\nS, C = []\nfor _ in range(m):\n s, c = map(int, input().split())\n S.append(s)\n C.append(c)\n \nfor num in range(10 ** (max(S) - 1), 10 ** n):\n num = str(num)\n f = 1\n for s, c in zip(S, C):\n s = s - 1\n if int(num[s]) != c:\n f = 0\n break\n \n if f:... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s312470417', 's361825712', 's557233904', 's914504074'] | [3188.0, 2940.0, 3064.0, 3064.0] | [18.0, 17.0, 19.0, 17.0] | [342, 8, 784, 470] |
p02761 | u272075541 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = [input() for _ in range(m)]\nb = set(a)\nc = [list(map(int, ai.split())) for ai in a]\nd = dict(c)\n\nif len(d) != len(b):\n print(-1)\nelse:\n if n == 1:\n print(d[0])\n else:\n if d[0] == 0:\n print(-1)\n else:\n ans = ["0"] * ... | ['Runtime Error', 'Accepted'] | ['s064352606', 's185911721'] | [3064.0, 3064.0] | [17.0, 19.0] | [398, 260] |
p02761 | u273345915 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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=[list(map(int,input().split())) for _ in range(M)]\n\nfor x in range(0, 1000):\n nx=x//10\n d=[x%10]\n while(nx):\n d.append(nx%10)\n nx//=10\n d.reverse\n\n if len(d)!=N: continue\n\n chk=True\n for i in range(M):\n if(d[arr[i][0]-1]!=arr[i]... | ['Wrong Answer', 'Accepted'] | ['s810668230', 's614130219'] | [3064.0, 3064.0] | [18.0, 19.0] | [357, 360] |
p02761 | u274635633 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m=map(int,input().split())\nx=0\ns=[list(map(int,input().split())) for i in range(m)]\ns=sorted(s)\nfor i in range(m):\n if s[i][0]==1 and s[i][1]==0:\n x=-1\n\nfor i in range(m):\n for j in range(m):\n if s[i][0]==s[j][0] and s[i][1]!=s[j][1]:\n x=-1\n\na=[0]*n\nfor i in range(m):\n a[s[i][0]]=s[i][1... | ['Runtime Error', 'Accepted'] | ['s935076929', 's896839293'] | [3064.0, 3064.0] | [18.0, 18.0] | [383, 321] |
p02761 | u276204978 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nN, M = map(int, input().split())\n\nl = [list(map(int, input().split())) for i in range(M)]\n\nr = np.zeros(3)\nr -= 1\n\nf = True\nfor i, j in l:\n i -= 1\n if N == i and j == 0:\n f = False\n if r[i] == -1:\n r[i] = j\n if r[i] != -1 and r[i] != j:\n f = False\... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s429466903', 's583127399', 's821738821', 's329874980'] | [13716.0, 12428.0, 12500.0, 12504.0] | [151.0, 151.0, 148.0, 149.0] | [398, 398, 621, 670] |
p02761 | u277312083 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = [[0, 0]] * m\nfor i in range(m):\n sc[i][0], sc[i][1] = map(int, input().split())\nsorted(sc)\n\ndef checker():\n if m == 0:\n if n == 1:\n return 0\n else:\n return -1\n for i in range(1, m):\n if sc[i - 1][0] == sc[i][0] and ... | ['Wrong Answer', 'Accepted'] | ['s854857049', 's106690217'] | [3192.0, 3188.0] | [18.0, 19.0] | [1577, 1211] |
p02761 | u278356323 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["# ABC157c\n\n\ndef main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n \n\n n, m = map(int, input().split())\n con = [list(map(int, input().split())) for _ in range(m)]\n num = ['a'] * n\n for s, c in con:\n if num[s - 1] == 'a' or num[s - 1] == c:\n ... | ['Wrong Answer', 'Accepted'] | ['s190167070', 's203767766'] | [3064.0, 3064.0] | [17.0, 24.0] | [707, 649] |
p02761 | u279266699 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 ans = [0] * n\n count = [0] * n\n for i in range(m):\n s, c = map(int, input().split())\n if s == 1 and c == 0:\n print(-1)\n exit()\n if count[s - 1] == 0:\n ans[s - 1] = c\n count[s - 1] += ... | ['Wrong Answer', 'Accepted'] | ['s557370432', 's138127846'] | [3064.0, 9216.0] | [17.0, 26.0] | [477, 1067] |
p02761 | u280853184 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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=[-1]*N\nfor _ in range(M):\n s,c=map(int,input().split())\n if sc[s-1]==-1 and sc[s-1]>c:\n sc[s-1]=c\n elif sc[s-1]!=-1 and sc[s-1]!=c:\n print("-1")\n sys.exit(0)\nfor i in range(N):\n if sc[i]==-1:\n sc[i]=0\nif sc[0]==0 and N!=1:\n print("-1")\n sys.e... | ['Wrong Answer', 'Accepted'] | ['s341676368', 's098549142'] | [3064.0, 3064.0] | [19.0, 18.0] | [496, 508] |
p02761 | u281610856 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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[0] = 1\ndata = [0] * m\nfor i in range(m):\n data[i] = list(map(int, input().split()))\narr = [0] * 3 \nfor j in range(m):\n s = data[j][0]-1\n c = data[j][1]\n before = ans[s]\n ans[s] = c\n after = ans[s]\n if before != after or after == 0:\... | ['Wrong Answer', 'Accepted'] | ['s727767500', 's812094756'] | [3064.0, 3064.0] | [17.0, 18.0] | [582, 870] |
p02761 | u283929013 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = []\nflag = True\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 flag = False\n break\n if s == M:\n if c == 0:\n flag = False\n break\n S.append(s)\n C.app... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s134080078', 's726869889', 's903217696', 's757655270'] | [3064.0, 3188.0, 3064.0, 3064.0] | [18.0, 20.0, 17.0, 17.0] | [469, 359, 286, 355] |
p02761 | u284363684 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\n\nc = []\n\nc_append = c.append\n\nfor i in range(M):\n sm, cm = map(int, input().split())\n if (sm, cm) not in c:\n c_append((sm, cm))\n\nif (1, 0) in c or list(set([sm for sm, cm in c])) == [sm for sm, cm in c]:\n print(-1)\nelse:\n ans = -1\n\n \n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s214381840', 's702226201', 's711666683', 's927009397'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0, 18.0] | [480, 478, 432, 376] |
p02761 | u289288647 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nans = [0]*N\nans1 = [0]*N\nfor _ in range(M):\n a, b = map(int, input().split())\n if ans[a-1] != 0 and ans[a-1] != b:\n ans[a-1] = -1\n elif ans[a-1] == 0:\n ans[a-1] = b\n ans1[a-1] = 1\n print(ans)\n\nif -1 in ans:\n print('-1')\ne... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s145149826', 's204426753', 's405632474', 's576793683', 's661502230', 's483260003'] | [9260.0, 9248.0, 9204.0, 9104.0, 9100.0, 9224.0] | [27.0, 26.0, 28.0, 28.0, 28.0, 31.0] | [685, 685, 710, 695, 697, 421] |
p02761 | u292849987 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["# coding:utf-8\n\nN, M = map(int, input().split(' '))\nans = ['-1' for _ in range(N)]\nfor _ in range(M):\n s, c = input().split(' ')\n if ans[int(s)-1] == '-1':\n ans[int(s)-1] = c\n elif ans[int(s)-1] == c:\n pass\n else:\n print('-1')\n exit(0)\n\nif ans[0] == '0' and len(an... | ['Wrong Answer', 'Accepted'] | ['s976465767', 's473260565'] | [3064.0, 3064.0] | [17.0, 17.0] | [526, 867] |
p02761 | u294385082 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = []\nif m == 0:\n if n==1:\n print(0)\n elif n==2:\n print(10)\n else:\n print(100)\nexit()\n\nfor i in range(m):\n S,C = map(int,input().split())\n s.append(S)\n c.append(C)\n \nnum = [1] + [0]*(n-1)\nans = ''\n \nfor i in range(m):\n if n != 1 and s[i] ==... | ['Wrong Answer', 'Accepted'] | ['s597051011', 's821085541'] | [3064.0, 3064.0] | [17.0, 18.0] | [624, 585] |
p02761 | u297103202 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['judge = False\ntarget = [-1 for i in range(N)]\nfor i in range(M):\n if sc[i][1] + target[sc[i][0]-1] == sc[i][1]-1 or sc[i][1] + target[sc[i][0]-1] == 2*sc[i][1]:\n target[sc[i][0]-1] = sc[i][1]\n else:\n print(-1)\n judge = True\n break\n\nif judge is False:\n for i in range(N):... | ['Runtime Error', 'Accepted'] | ['s940484028', 's264247608'] | [3064.0, 3064.0] | [18.0, 17.0] | [701, 789] |
p02761 | u301624971 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['SC=[]\nN,M = map(int,input().split())\n\nfor _ in range(M):\n SC.append(list(map(int,input().split())))\n\nans=[[0] for i in range(N)]\nfor value in SC:\n ans[value[0]-1].append(value[1])\nketa=10**(N-1)\nansw=0\nfor a in ans:\n a.pop(0)\n tmp=0\n for i in a:\n if(tmp==0 and keta!=1):\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s049990824', 's305716896', 's717144030', 's766419464', 's427543375'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 19.0, 18.0] | [465, 895, 598, 953, 538] |
p02761 | u304974600 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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" * n\nflag = 0\n\nfor _ in range(m):\n a, b = map(int, input().split())\n\n if s[a - 1] != \'0\':\n if s[a - 1] != str(b):\n flag = 1\n\n if n > 1 and a == 1:\n flag = 1\n \n s = s[:a-1] + str(b) + s[a:]\n\nif flag == 0:\n if n == 1:\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s102119249', 's526155844', 's057725389'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0] | [414, 588, 511] |
p02761 | u305388378 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 solution():\n n, m = map(int, input().split())\n cs = [list(map(int, input().split())) for i in range(m)]\n if m == 0:\n if n > 1:\n print("-1")\n else:\n print("0")\n return\n ans = [-1 for i in range(n)]\n for w in cs:\n s = w[0]\n c = w[1]... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s219384645', 's879988467', 's923097225', 's848299094'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0, 18.0] | [668, 663, 696, 553] |
p02761 | u306950978 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['fla = 0\nans = 0\n\nket , kaz = map(int,input().split())\nnum = [-1 for i in range(ket)]\nfor j in range(kaz):\n s , c = map(int,input().split())\n if num[s-1] == -1:\n num[s-1] = c\n elif num[s-1] != c:\n fla = -1\n break\n\nif fla == 0:\n if num[0] == 0:\n if ket != 1 \n ... | ['Runtime Error', 'Accepted'] | ['s268006621', 's716888563'] | [2940.0, 3064.0] | [17.0, 17.0] | [663, 658] |
p02761 | u311379832 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nchk = [0, 0, 0]\ncnt = [0, 0, 0]\nans = ''\ntmp = []\nans = -1\nsc2 = []\n\nfor i in range(M):\n if cnt[sc[i][0] - 1] == 0:\n chk[sc[i][0] - 1] = sc[i][1]\n cnt[sc[i][0] - 1] += 1\n sc2.append([sc[i][0]... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s605812234', 's945473268', 's097005698'] | [3064.0, 3064.0, 3064.0] | [19.0, 19.0, 19.0] | [662, 663, 394] |
p02761 | u311636831 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nLIST=[10]*N\nfor i in range(M):\n s,c = map(int,input().split())\n if LIST[s-1]==10:\n LIST[s-1]=c\n else:\n print(-1)\n exit()\n\nfor i in range(N):\n if LIST[i]==10:\n LIST[i]=0\n\nLIST2 = map(str, LIST) \nif N==1:\n print("".join(LIST2))\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s276098900', 's323460124', 's251206351'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 19.0] | [366, 289, 386] |
p02761 | u312158169 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n, m = map(int, input().split())\n\ns = [0] * m\nc = [0] * m\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n\nnum = 0\nt = 0\n\nif s == 1:\n for i in range(m-1):\n if c[i] != c[i+1]:\n print(-1)\n break\n print(c[0])\nelse:\n if len(set(s)) != len(s):\n f... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s050791638', 's303390447', 's887506166', 's454846773'] | [3444.0, 3444.0, 3064.0, 3064.0] | [21.0, 21.0, 17.0, 17.0] | [706, 782, 673, 791] |
p02761 | u312666261 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m = map(int,input().split())\nketa = []\nnumber = []\n\nfor i in range(m):\n n,a=input().split()\n keta.append(int(n))\n number.append(a)\n\nccount = 0\ncount = 0 \nans = 0\nif n == 3:\n ans = 100\nif n == 2:\n ans = 10\nif n == 1:\n ans = 0\n\nwhile count == 0:\n ans = str(ans)\n for i in rang... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s652143434', 's801786049', 's561381735'] | [3064.0, 3188.0, 3064.0] | [17.0, 2103.0, 19.0] | [638, 640, 683] |
p02761 | u314050667 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\ns,c = [],[]\nfor _ in range(M):\n\tts,tc = map(int ,input().split())\n\ts.append(ts)\n\tc.append(tc)\n\ncond = 0\nflg = [0] * N\nans = ['a'] * N\nfor i in range(M):\n\tif flg[s[i]-1] == 1:\n\t\tcond = 1\n\t\tbreak\n\telse:\n\t\tans[s[i]-1] = str(c[i])\n\t\tflg[s[i]-1] =... | ['Wrong Answer', 'Accepted'] | ['s296755294', 's070270763'] | [3064.0, 3444.0] | [17.0, 22.0] | [483, 476] |
p02761 | u316733945 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = [0]*n\n\nfor _ in range(m):\n a, s = map(int, input().split())\n s = str(s)\n if (l[a-1] and l[a-1] != s) or (a==1 and s=="0"):\n l = -1\n break\n else:\n l[a-1] = s\n\nif l == -1:\n print(l)\nelse:\n print("".join(l))', 'n, m = map(int, inp... | ['Runtime Error', 'Accepted'] | ['s453251083', 's009528040'] | [3064.0, 3064.0] | [17.0, 17.0] | [280, 388] |
p02761 | u317779196 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 n > 1:\n ns = list('1' + '0'*(n-1))\nelse:\n ns = list('0')\n\nss, cc = -1, -1\nfor i in range(m):\n s, c = map(int, input().split())\n if s == ss and c != cc:\n x = False\n break\n ns[s-1] = str(c)\n ss, cc = s, c\n \nif (len(ns) > 1 and ns[0] == ... | ['Runtime Error', 'Accepted'] | ['s255200952', 's662332052'] | [3064.0, 3064.0] | [18.0, 17.0] | [374, 380] |
p02761 | u318296597 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["from collections import Counter\nN,M = map(int,input().split())\ns = [0 for x in range(M)]\nc = [0 for x in range(M)]\nfor i in range(M) :\n s[i],c[i] = map(int,input().split())\n\nMatrix = [[0,0] for x in range(M)]\nfor i in range(M) : \n Matrix[i][0] = s[i]\n Matrix[i][1] = c[i]\n\nte = Counter(s)\nchofuku... | ['Wrong Answer', 'Accepted'] | ['s650107666', 's903081584'] | [3316.0, 3060.0] | [21.0, 19.0] | [982, 241] |
p02761 | u318859025 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nfor i in range(10**n):\n i2=str(i)\n if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):\n print(i2)\n break\nprint(-1)', 'n,m=map(int,input().split())\nsc=[list(map(int,input().split())) for i in range(m)]\n\nfor i... | ['Wrong Answer', 'Accepted'] | ['s663279150', 's110496888'] | [3060.0, 3060.0] | [19.0, 18.0] | [214, 215] |
p02761 | u324197506 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\n\na_list = [0] * N\n\nuncorrect = 0\nchangezero = True\n\nfor i in range(M):\n s,c = map(int, input().split())\n if s == 1:\n zero == False \n if a_list[s-1] == 0:\n a_list[s-1] += c\n else:\n if a_list[s-1] != c:\n uncorrect += 1\n\nif ch... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s088237945', 's278658159', 's451545753'] | [3188.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [519, 472, 524] |
p02761 | u326775883 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["n, m = [int(i) for i in input().split()]\n\nnum = ['0']*n\nl = [0]*n\nb = 0\nfor i in range(m):\n s, c = input().split()\n s = int(s)-1\n if l[s] == 0 or num[s] == c:\n num[s] = c\n l[s] = 1\n else:\n b += 1\n break\n\nif l[0] == 0 and n != 1:\n num[0] = '1'\nelse:\n b += 1\n \n\nif num[0] != '0'... | ['Wrong Answer', 'Accepted'] | ['s385134012', 's154776489'] | [3064.0, 3064.0] | [17.0, 17.0] | [367, 401] |
p02761 | u327532412 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 _ in range(M)])\nchk = {}\nfor s, c in SC:\n if s in chk:\n print(-1)\n exit()\n else:\n chk[s] == 0\nans = [-1] * N\nfor s, c in SC:\n if ans[s-1] == -1:\n ans[s-1] = c\nif N >= 2:\n if ans[0] == ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s058391979', 's129259584', 's078089277'] | [3188.0, 3572.0, 3064.0] | [19.0, 21.0, 18.0] | [464, 352, 371] |
p02761 | u328755070 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = list(map(int, input().split()))\nsc = []\nfor i in range(M):\n sc.append(list(map(int, input().split())))\n \nnum = "a" * N\n\nfor i in range(M):\n if num[sc[i][0]-1] == "a":\n num = num[:sc[i][0]-1] + str(sc[i][1]) + num[sc[i][0]:]\n else:\n if num[sc[i][0]-1] == str(sc[i][1]):\n ... | ['Wrong Answer', 'Accepted'] | ['s586426563', 's008871358'] | [3064.0, 3064.0] | [18.0, 19.0] | [501, 418] |
p02761 | u329399746 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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(" ")]\ncheck_list = []\n\nfor _ in range(M):\n check_list.append([int(i) for i in input().split(" ")])\n\nfor i in range(10 ** (N + 1)):\n i = str(i)\n for j in check_list:\n if i[j[0] - 1] != str(j[1]):\n break\n else:\n continue\n ... | ['Runtime Error', 'Accepted'] | ['s945495185', 's348219227'] | [3064.0, 3064.0] | [22.0, 18.0] | [361, 393] |
p02761 | u330169562 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = []\ntmp = True\nfor i in range(n): ans.append('a')\n\nfor i in range(m):\n s, c = map(int, input().split())\n\n if s == 1 and c == 0:\n tmp = False\n break\n\n if s > n:\n tmp = False\n break\n\n if c < 0 or c > 9:\n tmp = False\n ... | ['Runtime Error', 'Accepted'] | ['s785896827', 's643341780'] | [3064.0, 3064.0] | [17.0, 18.0] | [632, 664] |
p02761 | u334175843 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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,collections,copy,heapq,itertools,math,numpy,string\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef S(): return sys.stdin.readline().rstrip()\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef LS(): return list(sys.stdin.readli... | ['Wrong Answer', 'Accepted'] | ['s509284192', 's576765376'] | [20816.0, 12432.0] | [311.0, 151.0] | [932, 1179] |
p02761 | u334365640 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['\nv = []\nm = [False for _ in range(9)]\nfor i in range(3):\n a, b, c = map(int, input().split())\n v += [a, b, c]\n\nn = int(input())\nfor i in range(n):\n a = int(input())\n if a in v:\n m[v.index(a)] = True\n\ndef control():\n for i in range(3):\n if all(m[3*i:3*i+3]):\n ret... | ['Runtime Error', 'Accepted'] | ['s026096994', 's183081699'] | [3064.0, 3064.0] | [17.0, 17.0] | [471, 659] |
p02761 | u334617936 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['import numpy as np\nimport sys\n\ndef main():\n rule = {1:[0, 10], 2:[10, 100], 3:[100, 1000]}\n args = input().rstrip().split(\' \')\n N, M = int(args[0]), int(args[1])\n query = []\n for i in range(M):\n args = input().rstrip().split(\' \')\n query.append([int(args[0]), int(args[1])])\n... | ['Runtime Error', 'Accepted'] | ['s947894299', 's137942716'] | [12508.0, 12496.0] | [152.0, 155.0] | [851, 925] |
p02761 | u334928930 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['def input_int_list():\n return [int(thing) for thing in input().split(" ")]\n\ndef No():\n print(-1)\n exit()\n\n\nN,M=input_int_list()\ns_c_tuple_list=[input_int_list() for i in range(M)]\nthe_dict={}\nfor tup in s_c_tuple_list:\n s,c=tup\n if s==1 and c==0:\n No()\n if s in the_dict:\n ... | ['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s123286445', 's412082394', 's584012271', 's814038480', 's627572616'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 2022.0, 17.0, 2020.0, 17.0] | [497, 680, 588, 628, 666] |
p02761 | u339199690 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 m in range(M):\n si, ci = map(int, input().split())\n s.append(si)\n c.append(ci)\n\ns = 10 ** (N - 1)\nif N == 1:\n s -= 1\n\nfor i in range(s, 10 ** N):\n for m in range(M):\n if str(i)[s[m] - 1] != str(c[m]):\n break\n else:\... | ['Runtime Error', 'Accepted'] | ['s918165300', 's915424344'] | [3064.0, 3064.0] | [18.0, 18.0] | [345, 348] |
p02761 | u343977188 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\nX = [-1] * N#[-1,-1,-1.....]\nfor i in range(M):\n s, c = map(str, input().split())\n if s == 1 and N > 1 and c==0:\n print(-1)\n exit()\n if X[s-1] < 0:\n X[s-1] = c\n \n \n elif X[s-1] != c:\n print(-1)\n exit()\n\n\nif X[0] < 0 ... | ['Runtime Error', 'Accepted'] | ['s658432540', 's768737864'] | [3064.0, 3064.0] | [18.0, 17.0] | [866, 864] |
p02761 | u344813796 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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(10*n):\n num=str(i)\n if len(num)==n and all(num[s-1]==str(c) for s,c in SC):\n print(i)\n break\nelse:\n print(-1)\n', 'n,m=map(int,input().split())\nSC=[list(map(int,input().split())) for _ i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s034769539', 's343473836', 's804373609'] | [9160.0, 9060.0, 9028.0] | [26.0, 27.0, 26.0] | [232, 325, 223] |
p02761 | u346308892 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['\nimport numpy as np\nfrom functools import *\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\ndef II():\n return int(input())\n\ndirections=np.array([[1,0],[0,1],[-1,0],[0,-1]])\ndirections = list(map(np.array, directions))\n\nmod = 10**9+7\n\n\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s039869138', 's776840100', 's462220850'] | [12512.0, 12528.0, 12512.0] | [150.0, 154.0, 148.0] | [1238, 1258, 869] |
p02761 | u347452770 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 = [] \nl_2 = [] \nl_3 = [] \nnocounter = 0\nanswer = 100 \n \nif m == 0:\n print(0)\nelse:\n for i in range(m):\n a, b = map(int, input().split())\n if a == 1:\n l_1.append(b)\n elif a == 2:\n l_2.append(b)\n else:\n l_3.append(b)\n pv = l_1[0]\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s304237700', 's750523898', 's012236805'] | [3188.0, 3064.0, 3192.0] | [17.0, 17.0, 17.0] | [1229, 1235, 1579] |
p02761 | u347600233 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["n, m = map(int, input().split())\nans = [-1] * n\nexist = True\nfor i in range(m):\n s, c = map(int, input().split())\n if (n != 1 and (s, c) == (1, 0)) or (ans[s - 1] != -1 and ans[s - 1] != c):\n exist = False\n break\n else:\n ans[s - 1] = c\n\nif exist:\n for i in range(n):\n i... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s525864224', 's896867608', 's914600390', 's081409269'] | [8992.0, 3064.0, 3064.0, 9132.0] | [28.0, 17.0, 17.0, 28.0] | [476, 439, 481, 237] |
p02761 | u347640436 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\nsc = [tuple(map(int, input().split())) for _ in range(M)]\n\nfor i in range(1000):\n t = str(i)\n if len(t) != N:\n continue\n ok = True\n for s, c in sc:\n if t[int(s) - 1] != int(c):\n ok = False\n break\n if ok:\n print(i)\... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s384706568', 's774042519', 's846588073', 's031708043'] | [3060.0, 3316.0, 3316.0, 3060.0] | [18.0, 19.0, 19.0, 17.0] | [330, 321, 326, 325] |
p02761 | u348868667 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 sc = [list(map(int,input().split())) for _ in range(M)]\n tmp = [[] for _ in range(N)]\n for i in range(M):\n s,c = sc[i][0],sc[i][1]\n tmp[s-1].append(c)\n ans = []\n for i in range(N):\n if len(set(tmp[i])) >= 2:\n ans ... | ['Runtime Error', 'Accepted'] | ['s150852037', 's200002927'] | [3184.0, 3064.0] | [20.0, 18.0] | [810, 665] |
p02761 | u349888092 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = [0]*N\ndict1 = {}\nfor x in range(M):\n a,b = map(int,input().split())\n if((a in dict1) != True):\n dict1[a] = b\n elif(dict1[a] == b):\n dict1[a] = b\n else:\n print(-1)\n sys.exit()\nfor k, v in dict1.items():\n ans[k-1] =... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s077530412', 's238965257', 's629156837', 's808186081', 's959508629'] | [3064.0, 2940.0, 3064.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0, 17.0, 17.0] | [471, 556, 505, 556, 505] |
p02761 | u353652911 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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=["x"]*n\n\nfor i in range(m):\n a,b=map(int,input().split())\n \n if ans[a-1]=="x" or ans[a-1]==b:\n ans[a-1]=b\n else:\n print(-1)\n exit()\n\nif n==1 and ans[0]==0:\n print(0)\nelif n>1 and ans[0]==0:\n print(-1)\nelif "x" not in ans:\n pri... | ['Runtime Error', 'Accepted'] | ['s283397112', 's105643094'] | [3064.0, 3060.0] | [18.0, 18.0] | [441, 243] |
p02761 | u353919145 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['#graph implementation\nimport math\nn,m=map(int,input().split())\nans=[0]*n\nfor i in range(m):\n s,c=map(int,input().split())\n if ans[s-1]>=c:\n ans[s-1]=c\nif ans[0]==0:\n print(-1)\nelse:\n for i in ans:\n print(i,end="")\nprint()\n', 'def f():\n n, m = list(map(int, input().split()))\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s490831845', 's859596663', 's552028630'] | [3060.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [248, 499, 603] |
p02761 | u355853184 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\n\ns = []\nc = []\nfor i in range(M):\n x,y = map(int,input().split())\n s.append(x)\n c.append(y)\n\nans_list = [0 for i in range(N)]\n\nfor i in range(M):\n if ans_list[s[i]-1] != -1 and ans_list[s[i]-1] != c[i]:\n print(-1)\n exit()\n else:\n an... | ['Wrong Answer', 'Accepted'] | ['s449009533', 's194592220'] | [9248.0, 9252.0] | [31.0, 30.0] | [669, 681] |
p02761 | u357949405 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['N, M = map(int, input().split())\n\nS = []\nC = []\n\ncondition = [-1] * M\n\nfor _ in range(M):\n s, c = map(int, input().split())\n #S.append(s)\n #C.append(C)\n if condition[s-1] != c and condition[s-1] != -1:\n print(\'-1\')\n exit()\n condition[s-1] = c\n\nfor i, v in enumerate(condi... | ['Runtime Error', 'Accepted'] | ['s174143683', 's714947610'] | [3060.0, 3064.0] | [17.0, 17.0] | [380, 443] |
p02761 | u359619351 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(4100000)\n\nimport math\n\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG)\n\nlogger = logging.getLogger(__name__)\n\n\ndef resolve():\n \n \n N, M = [int(x) for x in sys.stdin.readline().split()] \n # h_list = [int(x) for x in sys.stdin.readline().split()] \... | ['Wrong Answer', 'Accepted'] | ['s870913993', 's273446431'] | [5656.0, 5648.0] | [42.0, 43.0] | [2147, 2286] |
p02761 | u363074342 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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\nif N == 1:\n kazu = list(range(10))\nelif N == 2:\n kazu = list(range(10,100,1))\nelse:\n kazu = list(range(100,1000,1))\n\n\nneikazu = kazu\n\nfor j in range(M):\n s, c = map(int,input().split())\n print(s,c)\n for i in range(1000):\n if i not in ka... | ['Wrong Answer', 'Accepted'] | ['s716775377', 's455640897'] | [3064.0, 3188.0] | [21.0, 21.0] | [817, 818] |
p02761 | u363421241 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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 _ in range(m):\n s, c = map(int, input().split())\n if ans[s-1] == 0:\n ans[s-1] = c\n else:\n print(-1)\n exit()\n\nans = [str(a) for a in ans]\nans = str(int(''.join(ans)))\nif len(ans) != n:\n print(-1)\nelse:\n print(ans)", 'n,... | ['Wrong Answer', 'Accepted'] | ['s627783975', 's267957424'] | [9056.0, 9052.0] | [30.0, 28.0] | [297, 342] |
p02761 | u363995337 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\n\nC = []\nS = []\n\nfor i in range(M):\n c, s = map(int, input().split())\n C.append(c)\n S.append(s)\n\nfor x in range(1000):\n keta = 1\n nx = x//10\n d = [x%10]\n\n\n while(nx):\n keta += 1\n d.append(nx%10)\n nx = nx // 10\n d = list... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s055447740', 's124013128', 's481426515', 's813455122'] | [3064.0, 3064.0, 3188.0, 3064.0] | [18.0, 19.0, 21.0, 18.0] | [521, 534, 531, 607] |
p02761 | u368563078 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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())\nsets = []\nfor i in range(M):\n s,c = input().split()\n sets.append((s,c))\nfor n in range(10**(N-1), 10**N):\n for s,c in sets:\n if not str(n)[int(s)-1] == c:\n break\n else:\n print(n)\n break\nelse:\n print(-1)', 'N,M = map(int, i... | ['Wrong Answer', 'Accepted'] | ['s907263506', 's282494127'] | [3060.0, 3064.0] | [17.0, 19.0] | [285, 316] |
p02761 | u368796742 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['n,m = map(int,input().split())\nans = [-1]*n\n\nfor i in range(m):\n a,b = map(int,input().split())\n if a == 1 and b == 0:\n print(-1)\n exit()\n if ans[a-1] == -1:\n ans[a-1] = b\n else:\n if b != ans[a-1]:\n print(-1)\n exit()\nif n != 1 and ans[0] == -... | ['Wrong Answer', 'Accepted'] | ['s101766093', 's217254289'] | [3064.0, 3064.0] | [18.0, 19.0] | [410, 351] |
p02761 | u370721525 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(0)', 'print(-1)', 'N, M = map(int, input().split())\nans = -1\nli = []\n\nfor i in range(M):\n s, c = map(int, input().split())\n if not s, c = 1, 0:\n li.append([s, c])\n \nif N==1 and li!=[]:\n ans = 0\n \nfor i in range(10**(N-1), 10**N):\n j = 0\n while j < M:\n num = str(i)\n l = li[j]\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s117621346', 's127096714', 's275923670', 's322127484'] | [2940.0, 2940.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 18.0] | [8, 9, 376, 353] |
p02761 | u373047809 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nL = [list(map(int,input().split())) for _ in range(m)] #s_i, c_i\n\nfor i in range(10**n): \n st = str(i)\n if len(i) == n and all(st[s-1] == str(c) for s, c in L): \n print(i)\n exit()\n\nprint(-1)', 'n, m = map(int, input().split())\nL = [list(map(int,input().... | ['Runtime Error', 'Accepted'] | ['s488058933', 's781534798'] | [3060.0, 3060.0] | [17.0, 18.0] | [379, 335] |
p02761 | u373295322 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\ndef get_minimun_val(n, rule_dict):\n max_val = 10**n\n min_val = 10**(n-1)\n if min_val = 1:\n min_val=0\n for i in range(min_val, max_val):\n str_i = str(i)\n flg = True\n for s, c in rule_dict.items():\n if str_i[s-1] == str(c):\n continue\n else:\n flg = False\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s445901803', 's624308033', 's029992216'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0] | [708, 818, 709] |
p02761 | u374501720 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ["n, m = map(int, input().split())\n\nif n == 1 and m == 0:\n print(0)\n exit()\n \nans = list(' '*n)\n\nfor i in range(m):\n a, b = map(int, input().split())\n \n if a==1 and b ==0:\n print(-1)\n exit()\n if ans[a-1] != ' ' and ans[a-1] != str(b):\n print(-1)\n exit()\n \n ans[a-1] = str(b)\n\n\... | ['Wrong Answer', 'Accepted'] | ['s672920366', 's501792589'] | [3064.0, 3064.0] | [19.0, 17.0] | [395, 361] |
p02761 | u374949588 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | [' coding: utf-8\n\nN, M = list(map(int, input().split()))\nbegin = 0 if N == 1 else 10**(N-1)\n\nsc = [[i for i in map(int, input().split())] for j in range(M)]\n\nfor i in range(begin, 10**N):\n flag = True\n for j in range(M):\n if str(i)[sc[j][0]-1] != str(sc[j][1]):\n flag = False\n ... | ['Runtime Error', 'Accepted'] | ['s139743557', 's420012836'] | [2940.0, 3064.0] | [17.0, 18.0] | [397, 398] |
p02761 | u375193358 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['import math\n\nN, M = map(int,input().split())\n\nif M == 0:\n if N == 1:\n print(0)\n else:\n print(10**(N-1))\nelse:\n s = list()\n c = list()\n\n for i in range(M):\n s_val, c_val = map(int, input().split())\n s.append(s_val)\n c.append(c_val)\n\n ans = 1000\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s323801017', 's353794960', 's502286384', 's536085645', 's496815479'] | [3192.0, 3064.0, 3188.0, 3188.0, 3064.0] | [21.0, 18.0, 22.0, 21.0, 20.0] | [765, 707, 705, 754, 763] |
p02761 | u376754170 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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())\nnums = [99] * n\n\nfor _ in range(m):\n n1, n2 = map(int, input().split())\n nums[n1-1] = min(nums[n1-1], n2)\n\n\nif nums[0] not in [99, 0]:\n print([x if x!=99 else 0 for x in nums])\nelse:\n print(-1)', 'n, m = map(int, input().split())\nrules = []\n\nfor x in range(m)... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s483953424', 's990648392', 's189259068'] | [9128.0, 9028.0, 9208.0] | [26.0, 24.0, 28.0] | [252, 521, 540] |
p02761 | u379142263 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef... | ['import sys\nn,m = map(int,input().split())\nans = [-1 for i in range(n)]\nfor i in range(m):\n s,c = map(int,input().split())\n s-=1\n if ans[s] == -1:\n ans[s] = c\n else:\n if c == ans[s]:\n continue\n else:\n print(-1)\n sys.exit()\n if n != 1:\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s375547175', 's392841049', 's053177718'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0] | [491, 727, 636] |
p02761 | u379692329 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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())\ncond = [list(map(int, input().split())) for _ in range(M)]\nflag = True\nans = [-1]*N\n\nif M == 0:\n if N == 1:\n print(0)\n else:\n print('1'+'0'*(N-1))\nelse:\n for i in cond:\n digit = i[0]-1\n if digit > N-1:\n flag = False\n break\n ... | ['Runtime Error', 'Accepted'] | ['s292270738', 's029580288'] | [2940.0, 3192.0] | [17.0, 19.0] | [718, 766] |
p02761 | u379959788 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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)]\nsc = list(map(list, set(map(tuple, sc))))\nM = len(sc)\nprint(M)\ntmp = [-1] * N\nfor i in range(M):\n if tmp[sc[i][0]-1] == -1:\n tmp[sc[i][0]-1] = sc[i][1]\n else:\n print(-1)\n exit()\n if sc[i... | ['Wrong Answer', 'Accepted'] | ['s773025511', 's578798346'] | [3064.0, 3064.0] | [18.0, 17.0] | [520, 626] |
p02761 | u380995377 | 2,000 | 1,048,576 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 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()]\nd = {}\nfor i in range(M):\n s,c = [int(i) for i in input().split()]\n if d.get(s,c) != c:\n print(-1)\n break\n else:\n d[s] = c\nelse:\n if d[1] == 0:\n print(-1)\n else:\n l=[str(d.get(1,1))]\n l=[str(d.get(i,0)) for ... | ['Runtime Error', 'Accepted'] | ['s612439346', 's969396407'] | [3064.0, 3064.0] | [18.0, 17.0] | [350, 400] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.