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
u901582103
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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=[10]*n\nprint(L)\nfor i in range(m):\n\ts,c=map(int,input().split())\n\tif L[s-1]==10 or L[s-1]==c:\n\t\tL[s-1]=c\n\t\tprint(L)\n\telse:\n\t\tprint(-1)\n\t\texit()\nif n==1:\n\tif L[0]==10:\n\t\tprint(0)\n\t\texit()\n\telse:\n\t\tprint(L[0])\n\t\texit()\nelse:\n\tif L[0]==10:\n\t\tL[0]...
['Wrong Answer', 'Accepted']
['s463350755', 's718745218']
[3064.0, 3064.0]
[17.0, 17.0]
[397, 376]
p02761
u903699277
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 \n \n N, N = map(int, input().split())\n SC = [list(map(int, input().split())) for _ in [0]*N ]\n SC.sort()\n\n num = (10 ** N) - 1\n keta = 1\n\n if SC[0][0] != 0:\n print('-1')\n exit()\n\n for S,C in SC:\n if S == 1 and C == 0:\n print(...
['Runtime Error', 'Accepted']
['s030275297', 's482499214']
[3064.0, 3060.0]
[18.0, 23.0]
[640, 185]
p02761
u904081717
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nnmlist = list(map(int, input().split()))\nN = nmlist[0]\nM = nmlist[1]\norder_list = [list(map(int, input().split())) for _ in range(M)]\n\ncnt = 0\n\nfor k in range(M):\n if order_list[k] == [1,0]:\n cnt += 1\n\nif cnt == M:\n print(0)\n sys.exit()\n\nfor j in range(M):\n if order_li...
['Runtime Error', 'Accepted']
['s788143120', 's280161558']
[3064.0, 3064.0]
[20.0, 17.0]
[734, 855]
p02761
u905329882
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 N == 1:\n minn = "0"\nelif N == 2:\n minn = "00"\nelif N == 3:\n minn = "000"\ncount = 0\nminnlist = list(minn)\nfor i in range(M):\n am, pm = map(int,input().split())\n s.append(am)\n c.append(pm)\n\nfor i in range(M):\n if minnlist[s[i]-1] != "...
['Wrong Answer', 'Accepted']
['s021871982', 's431736501']
[3064.0, 3064.0]
[18.0, 17.0]
[721, 721]
p02761
u907223098
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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())\nl=[None,None,None]\nanswer='unknown'\nfor i in range(m):\n a,b=(int(i) for i in input().split())\n if l[a-1]==None:\n l[a-1]=b\n elif l[a-1]!=b:\n answer='-1'\n break\nfor i in range(3):\n if l[i]==None:\n if i!=3-n:\n l[i]=0\n else:\n l[i]=1\nr=l[0]*1...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s199499178', 's270642131', 's568092643']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0]
[401, 399, 426]
p02761
u910632349
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nq=[list(map(int,input().split())) for _ in range(m)]\nfor i in range(10**n):\n i=str(i)\n f=1\n for j in q:\n if i[j[0]-1]!=str(j[1]):\n f=0\n break\n if f:\n print(i)\n exit()\nprint("-1")', 'n,m=map(int,input().split())\nq=[list(ma...
['Runtime Error', 'Accepted']
['s056818118', 's121527538']
[9012.0, 9156.0]
[28.0, 29.0]
[262, 297]
p02761
u912650255
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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([list(map(int,input().split())) for _ in range(M)])\n\n\nfor i in range(10**(N-1)-1,10**N):\n count = 0\n str_i = str(i)\n for j in range(M):\n if str_i[sc[j][0]-1] == str(sc[j][1]):\n count += 1\n if count == M:\n print(i)\n exit()...
['Runtime Error', 'Runtime Error', 'Accepted']
['s154908843', 's713759563', 's803084264']
[9140.0, 9164.0, 9120.0]
[28.0, 25.0, 29.0]
[317, 317, 360]
p02761
u913662443
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["stdin = open(0).read().split('\\n')\nN, M = map(int,stdin[0].split())\nif N==0:\n list=['0']\n for j in range(M):\n s, c = stdin[j+1].split()\n if list[int(s)-1]!=c:flag=False\n if flag:\n print(i)\n exit()\nelse:\n for i in range(10**(N-1),10**N):\n list=[str(i)]\n ...
['Runtime Error', 'Accepted']
['s667127222', 's327977589']
[3064.0, 3064.0]
[19.0, 20.0]
[495, 555]
p02761
u915879510
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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\nd = [0] * n\nr = 0\n\nfor i in range(m):\n s, c = list(map(int, input().split()))\n if (d[s-1] != 0) and (d[s-1] <= c):\n r = -1\n break\n else:\n d[s-1] = c\n\nif (r==-1):\n print(r)\nelse:\n dd = int(''.join(map(str, d)))\n if len(str(dd))==n:\n print(dd)\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s038481505', 's109078686', 's148303227', 's413966672', 's553417891', 's238354426']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0, 17.0, 17.0, 17.0]
[322, 507, 554, 333, 506, 569]
p02761
u917558625
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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=list(map(int,input().split()))\nt=[list(map(int,input().split())) for i in range(s[1])]\na=''\nb=0\nu=list(map(list,set(map(tuple,t))))\nu=(sorted(u,key=lambda x: x[0]))\nx=[0]*s[0]\nfor i in range(len(u)):\n c=t[i][0]-1\n if x[c]==0:\n x[c]+=t[i][1]+10\n else:\n b=1\nif b==1:\n print(-1)\nelse:\n x.reve...
['Wrong Answer', 'Accepted']
['s280542209', 's206867920']
[3064.0, 3064.0]
[17.0, 17.0]
[523, 709]
p02761
u917872021
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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\njouken = {}\nans = ''\nfor i in range(m):\n s, t = list(map(int, input().split()))\n if s in jouken.keys():\n if jouken[s] != t:\n ans = -1\n break\n else:\n jouken[s] = t\n \nif ans != -1:\n for j in range(n):\n keta =...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s442003994', 's983232358', 's314957496']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[609, 662, 631]
p02761
u918601425
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,K=[int(s) for s in input().split()]\nls=[-1 for _ in range(N+1)]\nfor _ in range(K):\n a,b=[int(s) for s in input().split()]\n if ls[a]==-1:\n ls[a]=b\n else:\n ls[0]=0\n \nprint(ls)\n\nif ls[0]==0:\n print(-1)\nelse:\n if N==1:\n ans=max([ls[1],0]) \n if N==2:\n for i in range(10,100):\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s074715156', 's577907505', 's310899540']
[3064.0, 3064.0, 3192.0]
[18.0, 18.0, 18.0]
[630, 623, 769]
p02761
u920204936
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\nsc = [list(map(int,input().split())) for i in range(M)]\nfor i in range(10**N):\n stop = True\n for t in sc:\n if i//(10**(N-t[0]))%10 != t[1]:\n stop = False\n if stop:\n print(i)\n break\nif stop:\n print(-1)\n', 'N,M = map(int,input().spli...
['Wrong Answer', 'Accepted']
['s443642545', 's511193309']
[3060.0, 3064.0]
[19.0, 18.0]
[276, 376]
p02761
u923712635
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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()]\ndi = {}\nflag = True\nfor _ in range(M):\n s, c = [int(i) for i in input().split()]\n if(s in di):\n if(di[s] != c):\n print(-1)\n flag = False\n break\n else:\n di[s] = c\n\nif(1 in di):\n if(di[1]==0):\n prin...
['Runtime Error', 'Accepted']
['s491048225', 's881313894']
[3064.0, 3064.0]
[18.0, 18.0]
[660, 770]
p02761
u926080943
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 digit = {}\n for i in range(m):\n s, c = map(int, input().split())\n if digit.get(s) is not None and digit.get(s) != c:\n print(-1)\n return\n digit[s] = c\n ans = ''\n for i in range(1, n+1):\n ans += st...
['Wrong Answer', 'Accepted']
['s363990246', 's391419210']
[3064.0, 3064.0]
[17.0, 17.0]
[445, 523]
p02761
u929996201
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nflg = 0\nflg2 = 0\n\nfor i in range(M):\n s,c = map(int, input().split())\n s -= 1\n if ans[s] == -1 or ans[s] == c:\n ans[s] = c\n else:\n flg = 1\n \nif flg == 0:\n if N == 1 and ans[0] == -1:\n print("0")\n elif ans[0] == 0:\n print("-1")\n else:\n ...
['Wrong Answer', 'Accepted']
['s554670576', 's468525941']
[9224.0, 9216.0]
[31.0, 30.0]
[493, 362]
p02761
u931118906
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nans = 0\nfor _ in range(m):\n a, b = map(int, input().split())\n a = a - 1\n if l[a] == -1 or l[a] == b:\n l[a] = b\n else:\n print(-1)\n exit()\n\nif n > 1 and l[0] == 0:\n print(-1)\nelif n == 1:\n print(l[0])\nelse:\n for i i...
['Runtime Error', 'Accepted']
['s381343471', 's389931777']
[3064.0, 3064.0]
[17.0, 18.0]
[503, 776]
p02761
u932868243
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 range(m)]\nfor i in range(1,m):\n for j in range(i+1,m+1):\n if sc[i-1][0]==sc[j-1][0] and sc[i-1][1]!=sc[j-1][1]:\n print(-1)\n exit()\n\nfor t in range(1,m+1):\n if sc[t][0]>=2 and sc[t][1]==0:\n print(-1)\n exit()\n\nfor i in...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s089594804', 's159870105', 's377559574', 's626175580', 's899155502', 's027534076']
[2940.0, 3064.0, 3192.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0, 19.0, 18.0, 17.0]
[527, 430, 395, 541, 468, 451]
p02761
u933129390
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 for i in range(n)]\nbad = False\nfor i in range(m):\n s, c = map(int, input().split())\n if s==1 and c==0:\n if n==1:\n pass\n else:\n print(-1)\n bad = True\n break\n elif ans[s-1]!="0" and int(ans[s-1])!=c:...
['Wrong Answer', 'Accepted']
['s977941214', 's147253721']
[3064.0, 3064.0]
[17.0, 19.0]
[514, 398]
p02761
u934052933
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 = []*m, []*m\n for i in range(m):\n a, b = map(int, input())\n s.append(a), c.append(b)\n for i in range(0, 10 ** n):\n loop = True\n string = str(i)\n if len(string) != n:\n continue\n for j in rang...
['Runtime Error', 'Accepted']
['s578824200', 's712495685']
[3064.0, 3064.0]
[17.0, 18.0]
[501, 509]
p02761
u934442292
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = [int(i) for i in input().split()]\ns = [0] * M\nc = [0] * M\nfor i in range(N):\n s[i], c[i] = map(int, input().split())\n\nans = 1000\nfor i in range(1000):\n S = str(i)\n if len(S) != N:\n continue\n \n is_ok = True\n for j in range(M):\n if S[s[j]] != c[j]:\n is_ok = False\n \n if is_...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s056000559', 's156088843', 's688609474', 's800546975', 's878647707']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0, 19.0, 19.0]
[375, 375, 375, 377, 382]
p02761
u934740772
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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=10**(N-1)\nif M==0:\n print(ans)\nelse:\n S=[]\n C=[]\n for i in range(M):\n s,c=map(int,input().split())\n S.append(s)\n C.append(c)\n for i in range(1000):\n flag=True\n I=str(i)\n for j in range(M):\n if N<S[j]:\n...
['Runtime Error', 'Accepted']
['s527675224', 's384347247']
[3064.0, 3064.0]
[18.0, 18.0]
[495, 590]
p02761
u935642171
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int, input().split())\nnum = [0]*n\ntf = True\nfor _ in range(m):\n d = list(map(int, input().split()))\n if d[0]==1 and n>1:\n tf = False\n break\n if num[d[0]-1] == 0:\n num[d[0]-1] = d[1]\n continue\n if num[d[0]-1] != d[1]: \n tf = False\nif num[0]==0 and n>1:\n num[0] = 1\nif tf:\n ...
['Wrong Answer', 'Accepted']
['s274470750', 's208734780']
[9236.0, 9188.0]
[28.0, 27.0]
[400, 412]
p02761
u936050991
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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\n \nout = [\'a\']*n\nerr_flg = False\n\nfor i in range(m):\n s = list(map(int, input().split()))\n\n if s[0]==1 and s[1]==0 and n > 1:\n err_flag = True\n elif s[0]==1 and s[1]==0 and n==1:\n print(\'0\')\n elif m==0 and n==1:\n print(\'0\')...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s041417750', 's228226817', 's683001260', 's719472577', 's767527580']
[3064.0, 3064.0, 3188.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0, 18.0, 20.0]
[671, 674, 641, 645, 766]
p02761
u936985471
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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=[-1]*N\nfor i in range(M):\n s,c=map(int,input().split())\n s-=1\n if C[s]!=-1:\n if C[s]!=c:\n print(-1)\n exit(0)\n C[s]=c\n \nif N>1 and C[0]==0:\n print(-1)\n exit(0)\n \nans=""\nfor i in range(len(C)):\n if C[i]==-1:\n if i==0:\n ans+="1"\n else:\n...
['Wrong Answer', 'Accepted']
['s106051905', 's866617901']
[3064.0, 3064.0]
[17.0, 18.0]
[395, 588]
p02761
u940533000
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['import numpy as np\nN, M = map(int, input().split())\ns, c = [], []\nfor i in range(M):\n tmp_s, tmp_c = map(int, input().split())\n s.append(tmp_s)\n c.append(tmp_c)\n\nflag = 0\nv_set = np.zeros(N)\n#print(v_set)\nfor i in range(M):\n if len(v_set) != 1 and s[i] == 1 and c[i] == 0:\n flag = 0\n break\n e...
['Runtime Error', 'Accepted']
['s242802892', 's502529997']
[12508.0, 12500.0]
[151.0, 149.0]
[554, 801]
p02761
u940765148
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\ndef getLine():\n return list(map(int, input().split()))\nn,m = getLine()\nr = np.full(n,-1)\nfor i in range(m):\n a,b = getLine()\n \n if r[a - 1] == -1:\n r[a - 1] = b\n elif r[a - 1] != b:\n print(-1)\n break\nelse:\n if (n > 1 and r[0] <= 0) or (n == 1 and...
['Runtime Error', 'Accepted']
['s251827604', 's599193613']
[14540.0, 12452.0]
[149.0, 157.0]
[457, 545]
p02761
u941644149
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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_l = [0 for i in range(N)]\nans = ""\nbool_list = [False for i in range(N)]\nflag = 0\nS = []\nC = []\n\nfor m in range(M):\n s, c = map(int, input().split())\n if (bool_list[s-1] == True) & (ans_l[s-1] != c):\n ans = "-1"\n flag = 1\n break\n else:\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s055731989', 's456799148', 's115801016']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[775, 393, 489]
p02761
u943057856
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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=-1\nfor i in range(10**3):\n if (len(str(i))==n):\n flag=1\n for s,c in sc:\n if str(i)[s-1] != str(c):\n flag=0\n if flag==1:\n ans =i\n break\n...
['Wrong Answer', 'Accepted']
['s137490411', 's203142052']
[3060.0, 3060.0]
[19.0, 19.0]
[316, 304]
p02761
u944643608
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["N, M = map(int, input().split())\nsc = [list(map(int, input().split())) for i in range(M)]\nsc.sort()\nif N == 1:\n tmp = sc[0][1]\n for i in range(M):\n if tmp != sc[i][1]:\n print(-1)\n break\n print(tmp)\nelse:\n ans_lis = [0] * N\n tmp_s = sc[0][0]\n tmp_c = sc[0][1]\n for i in range(M):\n ...
['Runtime Error', 'Accepted']
['s083629389', 's602920742']
[3064.0, 3064.0]
[17.0, 17.0]
[722, 1005]
p02761
u947101138
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nlisting=[]\nfor i in range(M):\n a=list(map(int,input().split(" ")))\n listing.append(a)\n\n\naa=list(map(list, set(map(tuple, listing))))\n\nfor i in aa:\n \n\n\n\nif(N==1 and aa[0][0]==1):\n print(aa[0][1])\n exit()\n\n\n\na1=[]\na2=[]\nfor i in aa:\n a1.append(i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s543582162', 's876836575', 's562743654']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[764, 765, 873]
p02761
u948521599
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N , M =map(int,input())\n\nketa_list=[]\nnum_list=[]\nfor x in range(M):\n s,c =map(int,input().split())\n keta_list.append(s)\n num_list.append(c)\nsiteilist=[0]*N\nsiteilist[0]=1\nerrer =0\napperlist =[]\n\nfor i,x in enumerate(keta_list):\n siteilist[x-1]=num_list[i]\n if x == 1 and num_list[i]==0:\...
['Runtime Error', 'Accepted']
['s575354049', 's288891597']
[3064.0, 3064.0]
[20.0, 17.0]
[727, 783]
p02761
u949115942
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nscs = []\nfor i in range(m):\n scs.append(list(map(int, input().split())))\n \nnumber = [-1] * n\nfor sc in scs:\n if number[sc[0] - 1] == -1:\n number[sc[0] - 1] = sc[1]\n elif number[sc[0] - 1] != sc[1]:\n number = []\n break\n\nif len(number) > 1...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s491262765', 's834189282', 's177092165']
[3064.0, 3064.0, 3188.0]
[18.0, 19.0, 19.0]
[539, 707, 806]
p02761
u951480280
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nnum=["0"]*n\nans=0\nfor i in range(m):\n s,c=input().split()\n s=int(s)\n if s==0 and c=="0":\n ans=-1\n elif num[s-1] != "0":\n num[s-1] = c\n else:\n if num[s-1] != c:\n ans=-1\n\nif num[0] == 0:\n num[0] = "1"\nif ans==-1:\n print(a...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s250310847', 's745137923', 's987126285', 's196314315']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 17.0]
[340, 342, 370, 461]
p02761
u954153335
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nfor _ in range(m):\n s,c=map(int,input().split())\n if ans[s-1]!=0 and ans[s-1]!=c:\n print(-1)\n sys.exit()\n if s==1 and c==0 and n!=1:\n print(-1)\n sys.exit()\n ans[s-1]=c\nif ans[0]==0 and n!=0:\nnum=0\nfor i in range(n)...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s378841860', 's565950076', 's611801681']
[9000.0, 9128.0, 9220.0]
[27.0, 27.0, 28.0]
[346, 329, 359]
p02761
u955125992
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["from operator import itemgetter\n\nn, m = map(int, input().split())\n\nnum = [''] * n\n\nif m == 0:\n for i in range(n):\n num[i] = '0'\n if n != 1:\n num[0] = '1'\n print(''.join(num))\n exit()\n\nsc = sorted([list(map(int, input().split())) for _ in range(m)], key = itemgetter(0))\n\nlast ...
['Runtime Error', 'Accepted']
['s276843999', 's037591527']
[3188.0, 3064.0]
[19.0, 18.0]
[758, 765]
p02761
u956811090
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\ns = []\nc = []\na = [10, 10, 10]\nflag = 0\nans = 0\n \nfor i in range(M):\n s1,c1=[int(i) for i in input().split()]\n s.append(s1)\n c.append(c1)\n \nfor i in range(M):\n if a[s[i] - 1] == 10 or a[s[i] - 1] == c[i] :\n a[s[i] - 1] = c[i]\n else:\n flag = 1\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s017636523', 's761302473', 's860572654', 's833315718']
[3064.0, 3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[589, 558, 9, 368]
p02761
u960250266
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = [x for x in range(n)]\ndic = {}\nnot_found = False\nspecial_case = False\nfor i in range(m):\n a, b = map(int, input().split())\n if str(a) not in list(dic.keys()):\n dic[str(a)] = b\n else:\n if dic[str(a)] != b:\n not_found = True\n lst[a ...
['Runtime Error', 'Accepted']
['s315285641', 's809311338']
[3064.0, 3188.0]
[18.0, 18.0]
[856, 811]
p02761
u962535482
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = []\ntf = True\nfor i in range(M):\n sc.append(list(map(int, input().strip().split()))\nnum = []\nfor i in range(N):\n num.append(0)\nfor i in sc:\n if i[0] == N and i[1] == 0:\n tf = False\n else:\n num[i[0]-1] = i[1]\nif tf:\n num[0] = 1\nstring = ""\nfor i in num:\n...
['Runtime Error', 'Accepted']
['s024006269', 's231190711']
[2940.0, 3064.0]
[17.0, 18.0]
[360, 720]
p02761
u963764813
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M = map(int,input().split())\n\nlst = [-1]*N\nflag = False\n\nfor _ in range(M):\n s,c = map(int,input().split())\n if lst[s-1] > -1:\n flag = True\n elif s == 1 and c== 0:\n flag = True\n else:\n lst[s-1] = c\nif flag:\n print("-1")\nelse:\n for i in range(N):\n if i == 0 & lst[i] == -1:\n l...
['Wrong Answer', 'Accepted']
['s016161506', 's372612714']
[3064.0, 3064.0]
[17.0, 19.0]
[386, 482]
p02761
u966836999
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["#157\ndef main():\n N, M = map(int,input().split())\n num = [-1]*N\n for i in range(M):\n s, c = map(int,input().split())\n if(s==1 and c==0 and N!=1):\n print(-1)\n return\n if(num[s-1]==-1 or num[s-1]==c):\n num[s-1] = c\n else:\n prin...
['Runtime Error', 'Accepted']
['s208368481', 's882342829']
[3064.0, 3064.0]
[18.0, 18.0]
[613, 613]
p02761
u968404618
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nNUM = [0]*n\nfor s, c in SC:\n if NUM[n-s] == 0:\n NUM[n - s] = c\n elif NUM[n-s] != 0 and NUM[n-s] != c:\n print("-1")\n exit()\n\nif NUM[n-1] == 0:\n print(-1)\n exit()\n\nfor s in NUM[::-1]:\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s268552545', 's325257544', 's341450088', 's411971378', 's428488630', 's812399960', 's171099631']
[9108.0, 9160.0, 9152.0, 9160.0, 3444.0, 3444.0, 9132.0]
[27.0, 29.0, 28.0, 29.0, 22.0, 22.0, 28.0]
[324, 404, 438, 553, 405, 513, 413]
p02761
u968846084
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nif m==0:\n if n==1:\n print(0)\n elif n==2:\n print(10)\n elif n==3:\n print(100)\n sys.exit()\nA=[0]*n\nB=[[0]*2 for i in range(m)]\nfor i in range(m):\n B[i]=list(map(int,input().split()))\nB.sort()\nif B[0]==[1,0]:\n print(-1)\n sys.exit()\nfor i in range(m...
['Wrong Answer', 'Accepted']
['s122269693', 's303809278']
[3064.0, 3064.0]
[18.0, 18.0]
[524, 573]
p02761
u969211566
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m = map(int,input().split())\nsc = [list(map(int,input().split())) for i in range(m)]\nans = [0]*(n+1)\nanswer = 0\nfor i in range(m):\n dig = sc[i][0]\n if ans[dig] == 0 or ans[dig] == sc[i][1]:\n ans[dig] = sc[i][1]\n else:\n print("-1")\n exit()\nfor i in range(1,n+1):\n answer += ans[i]*10**(n-i)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s306306072', 's591478409', 's566444338']
[3064.0, 3064.0, 3060.0]
[18.0, 17.0, 18.0]
[407, 403, 251]
p02761
u969708690
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nL=[-1]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if L[a-1]!=-1:\n if L[a-1]!=b:\n print(-1)\n exit()\n else:\n L[a-1]=b\n if a==1 and b==0:\n print(-1)\n exit()\nfor i in range(len(L)):\n if L[i]==-1:\n L[i]=0\nL=list(map(int,L))\nprint("".join(...
['Runtime Error', 'Accepted']
['s786563681', 's173461360']
[9200.0, 9184.0]
[30.0, 30.0]
[304, 401]
p02761
u969850098
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 if s == 1 and c == 0:\n print(-1)\n exit()\n if s in S:\n if C[S.index(s)] != c:\n print(-1)\n exit()\n else:\n continue\n S.append(s)\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s269476653', 's364076574', 's200122291']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[495, 597, 670]
p02761
u971091945
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nli = [0]*n\n\nfor i in range(m):\n s, c = map(int, input().split())\n if li[s-1] != 0 and li[s-1] != c:\n print(-1)\n exit(0)\n if s==1 and c==0:\n print(-1)\n exit(0)\n li[s-1]=c\n\nif n>1 and li[0]==0:\n li[0]=1\n\nfor i in range(n):\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s247997567', 's257783450', 's672423772', 's428557819']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 20.0, 18.0, 19.0]
[322, 314, 314, 369]
p02761
u971124021
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-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 = [0]*(N+1)\nfor m in range(M):\n sc = list(map(int,input().split()))\n if SC[sc[0]] == 0:\n if sc[0] != 1:\n SC[sc[0]] = sc[1]\n else:\n print(-1)\n exit()\n else:\n if SC[sc[0]] != sc[1]:\n print(-1)\n exit()\n\nif SC[1]==0:\n SC[1] = 1\...
['Wrong Answer', 'Accepted']
['s835436083', 's702000345']
[3064.0, 3064.0]
[18.0, 17.0]
[370, 561]
p02761
u973758681
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N, M = map(int, input().split())\nnum = [None]*N\nres = 0\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:\n res = -1\n break \n if num[s] == None:\n num[s] = c\n elif num[s] != c:\n res = -1\n break\n\nprint(res) if...
['Runtime Error', 'Accepted']
['s064360070', 's829411681']
[3064.0, 3064.0]
[19.0, 17.0]
[424, 411]
p02761
u973972117
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N,M =map(int,input().split())\njudge = [list(map(int,input().split())) for i in range(M)]\ndef Num(x):\n return list(str(x))\nAn = -1\nfor j in range(10**(N-1),10**N):\n if An != -1:\n break\n Numi = Num(j)\n A = 0\n for i in range(M):\n if Numi[judge[i][0]-1] != judge[i][1]:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s329986074', 's469705314', 's993399865']
[9108.0, 3064.0, 9248.0]
[28.0, 18.0, 29.0]
[375, 850, 756]
p02761
u974792613
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nconds = []\n\nfor i in range(m):\n s, c = map(int, input().split())\n conds.append([s, c])\n\n\nconds = sorted(conds)\nfor i in range(len(conds)):\n if i + 1 < len(conds) and (\n conds[i][0] == conds[i + 1][0] and conds[i][1] != conds[i + 1][1]\n ):\n prin...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s148839267', 's392930142', 's040190438']
[3064.0, 3192.0, 3064.0]
[17.0, 17.0, 17.0]
[734, 1496, 842]
p02761
u975039852
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = [-1] * n\nflag = False\nfor i in range(m):\n s, c = map(int, input().split())\n if c != lst[s-1] or (n != 1 and s == 1 and c == 0):\n flag = True\n lst[s-1] = c\nif flag:\n print(-1)\nelse:\n for i in range(n):\n if lst[i] == -1:\n lst[i] = '1' if n != 1 and i =...
['Wrong Answer', 'Accepted']
['s844678447', 's446784620']
[3064.0, 3064.0]
[17.0, 18.0]
[376, 306]
p02761
u977771109
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nrl = sys.stdin.readline\n\nn, m = [int(x) for x in rl().split(' ')]\n\ndigits = [-1 for x in range(n)]\nfor i in range(m):\n s, c = [int(x) for x in rl().split(' ')]\n digits[s-1] = c\n\nhasNonZero = False\nfor i in range(len(digits)):\n if digits[i] > 0:\n hasNonZero = True\n elif digi...
['Wrong Answer', 'Accepted']
['s335647239', 's565564531']
[3064.0, 3064.0]
[17.0, 17.0]
[477, 713]
p02761
u979038517
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['\ndef main():\n N, M = [int(x) for x in input().split()]\n expected_num_ary = [0] * N\n\n digit = []\n value = []\n for _ in range(M):\n d, v = [int(x) for x in input().split()]\n if d > N:\n print("-1")\n return\n if expected_num_ary[d - 1] != 0:\n ...
['Wrong Answer', 'Accepted']
['s449277002', 's672321524']
[3064.0, 3064.0]
[17.0, 17.0]
[563, 718]
p02761
u979126665
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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(" "))\nnums = [-1] * 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 sys.exit(0)\n if nums[s-1] != -1 and c != nums[s-1]:\n print(-1)\n sys.exit(0)\n nums[s-1] = c\nnums = [0 for n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s570879969', 's676537701', 's007300668']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[448, 457, 448]
p02761
u981040490
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 -*-\ndef main():\n N,M = map(int,input().split())\n SC = [list(map(int,input().split())) for i in range(M)]\n #print(N,M,SC)\n ans = []\n for _ in range(N):\n ans.append(-1)\n #print(ans)\n for j in range(M):\n if ans[SC[j][0]-1] == -1 or ans[SC[j][0]-1] == SC[j...
['Wrong Answer', 'Accepted']
['s940228912', 's090158927']
[3064.0, 3064.0]
[17.0, 17.0]
[575, 695]
p02761
u981332890
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\ndef main():\n N, M = map(int, input().split())\n\n ans = {i:0 for i in range(N)}\n for _ in range(M):\n s, c = map(int, input().split())\n\n ans[s-1] = c\n if ans[0] == 0:\n print(-1)\n return 0\n\n for v in ans.values():\n print(v, end="")\n\n\n\n\n r...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s098623374', 's108343527', 's117347379', 's277544703']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[344, 528, 436, 461]
p02761
u985125584
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["import sys\n\nN, M = map(int, input().split())\n\nans = ['*'] * N\n\nif M == 0:\n if N == 1:\n print(0)\n else:\n print(10**(N-1))\nelse:\n for i in range(M):\n a, b = map(int, input().split())\n\n if ans[a-1] == '*':\n ans[a-1] = str(b)\n else:\n prin...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s339301717', 's735002757', 's469580911']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[528, 571, 518]
p02761
u987170100
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = [0] * N\nif M == 0 and N != 1:\n lst[0] = 1\nelse:\n dic = {}\n for _ in range(M):\n s, c = map(int, input().split())\n n = dic.get(s)\n if n is not None and n != c:\n print(-1)\n exit()\n dic[s] = c\n\nif N != 1 and ls...
['Runtime Error', 'Accepted']
['s883906383', 's549983239']
[3064.0, 3064.0]
[20.0, 17.0]
[466, 508]
p02761
u987326700
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = []\nwhile True:\n try:\n tmp = list(map(int,input().split()))\n s.append(tmp[0])\n c.append(tmp[1])\n except EOFError:\n break\n \nfor i in range(10**(n-1)-1,10**n):\n cnt =0\n tmp = str(i)\n for _ in range(len(c)):\n if tmp[s[_]-1]==str(c[_]):\n c...
['Runtime Error', 'Accepted']
['s467126993', 's367113900']
[3064.0, 3064.0]
[19.0, 19.0]
[364, 417]
p02761
u989348352
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['N , M = [int(i) for i in input().split()]\ns = [[int(j) for j in input().split()] for i in range(M)]\n#print(s)\n#print(c)\nx = 0\n\ns = list(map(list, set(map(tuple, s))))\nf = [0] * N\n\n#print(f)\nfor ss in s:\n if f[ss[0]-1] == 1:\n x = -1\n break\n if ss[0] == 1 and ss[1]==0:\n if N =...
['Wrong Answer', 'Accepted']
['s017748685', 's849024499']
[3064.0, 3064.0]
[17.0, 17.0]
[544, 683]
p02761
u991567869
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n, m = map(int, input().split())\ns = [list(map(int, input().split())) for _ in range(m)]\ncnt = 0\n\nfor i in range(1000):\n il = len(str(i))\n if il == n:\n for j in range(m):\n if il >= j + 1:\n num = s[j][0] - 1\n k = str(i)\n if str(s[j][1]) ==...
['Wrong Answer', 'Accepted']
['s691569195', 's866985822']
[3064.0, 3064.0]
[20.0, 20.0]
[440, 535]
p02761
u992910889
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['def resolve():\n N, M = map(int, input().split())\n S, C = [0] * M, [0] * M\n for i in range(M):\n S[i], C[i] = map(int, input().split())\n\n def main():\n if M==0:\n if N==1:\n return 10\n elif N==2:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s197127267', 's996456911', 's229579520']
[3064.0, 3064.0, 3188.0]
[18.0, 18.0, 19.0]
[632, 649, 753]
p02761
u993090205
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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 io import StringIO\nimport unittest\n\n\ndef exists(value, n, ms, cs):\n if len(value) != n:\n return False\n if all([value[i - 1] == c for i, c in zip(ms, cs)]):\n return True\n return False\n\n\ndef unzip(li):\n return list(map(list, zip(*li)))\n\n\ndef resolve():\n res...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s065205427', 's176914127', 's552308239', 's642113645', 's663315075', 's858067970', 's539168154']
[6464.0, 3064.0, 2940.0, 3064.0, 2940.0, 3064.0, 3064.0]
[69.0, 19.0, 17.0, 18.0, 19.0, 18.0, 18.0]
[654, 506, 453, 449, 503, 436, 452]
p02761
u993310962
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\nbuf=0\nfor i in range(m):\n s,c=map(int,input().split())\n if ans[s-1]==0:\n ans[s-1]+=c\n elif ans[s-1]!=0 and c!=ans[s-1]:\n buf+=1\nif buf==0 and ans[0]!=0:\n anstr=[str(num) for num in ans]\n print(''.join(ans))\nelif buf==0 and ans[0]==0:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s166266962', 's359400514', 's035639774']
[3064.0, 2940.0, 3064.0]
[18.0, 17.0, 18.0]
[335, 824, 529]
p02761
u993622994
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 s, c = map(int, input().split())\n if ans[s-1] == str(c):\n continue\n elif ans[s-1] == '-1':\n ans[s-1] = str(c)\n else:\n ans = -1\n print(ans)\n exit()\n\nfor i in range(N):\n if ans[i] == '...
['Runtime Error', 'Accepted']
['s216393015', 's914396613']
[3064.0, 3188.0]
[17.0, 20.0]
[517, 436]
p02761
u995419623
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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())\nans=-1\narr = [list(map(int,input().split)) for i in range(b)]\n\nfor i in range(1001):\n j=str(i)\n if len(j)==a and all(j[s-1]==str(t) for s,t in arr):\n ans = i\n break\nprint(ans)', 'a,b=map(int,input().split())\nans=-1\narr = [list(map(int,input().split())) for i in range(b)...
['Runtime Error', 'Accepted']
['s364177851', 's804086516']
[3060.0, 3064.0]
[17.0, 19.0]
[212, 214]
p02761
u995861601
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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\n\nr = True\nfor i in range(m):\n s, c = map(int, input().split())\n if l[s-1] == -1:\n l[s-1] = c\n else:\n if l[s-1] != c:\n r = False\n\nif l[0] == -1:\n if n == 1:\n l[0] = 0\n else:\n l[0] = 1\n\nfor i in range(1, ...
['Runtime Error', 'Accepted']
['s105620350', 's949435518']
[3064.0, 3064.0]
[17.0, 17.0]
[407, 469]
p02761
u996434204
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = []\n\nfor i in range(m):\n s,c = map(int,input().split())\n li.append([s,c])\n\nfor i in range(10**(n-1),10**n):\n buf = str(i)\n flag = True\n for j in range(len(li)):\n if buf[li[j][0]-1] != str(li[j][1]):\n flag = False\n if flag:\n a...
['Runtime Error', 'Accepted']
['s060335629', 's657560852']
[3064.0, 3064.0]
[17.0, 19.0]
[397, 703]
p02761
u996506712
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
['n,m=map(int,input().split())\nif m=0:\n print(0)\nelse:\n sc= [list(map(int,input().split())) for i in range(m)]\n ans = -1\n s=[[0 for i in range(2)] for i in range(n)]\n for j in range(10**n):\n k=str(j)\n for l in range(len(k)):\n s[l][0]=l+1\n s[l][1]=int(k[l])\n if all(elm in s for elm in...
['Runtime Error', 'Runtime Error', 'Accepted']
['s194392659', 's211838657', 's150738008']
[9008.0, 8840.0, 9240.0]
[23.0, 25.0, 30.0]
[353, 351, 449]
p02761
u998082063
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other 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 = []\none = 1000\ntwo = 11000\nthree = 10000\nfor i in range(m):\n s, c = map(int, input().split())\n tup = (s, c)\n tmp.append(tup)\n\ns = set(tmp)\nfor a, b in s:\n if a == 1:\n if one > b:\n one = b*100\n elif a == 2:\n if two > b:\n ...
['Wrong Answer', 'Accepted']
['s642305083', 's778582542']
[3064.0, 4072.0]
[18.0, 29.0]
[453, 734]
p02761
u998741086
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be 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\nn, m = map(int, input().split())\ns = [-1 for _ in range(m)]\nc = [-1 for _ in range(m)]\nfor i in range(m):\n s[i], c[i] = map(int, input().split())\n\nfor x in range(1000):\n keta = 1 \n nx = x/10\n d = []\n while nx: \n keta += 1\n d.append(nx%10)\n nx /=...
['Runtime Error', 'Accepted']
['s177222289', 's698798105']
[3064.0, 3064.0]
[152.0, 20.0]
[505, 582]
p02761
u999503965
2,000
1,048,576
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \lef...
["n,m=map(int,input().split())\nl=[list(map(int,input().split())) for i in range(m)]\n\nnum=[-1]*n\n\nfor i in l:\n if num[i[0]-1]==-1 or num[i[0]-1]==i[1]:\n num[i[0]-1]=i[1]\n elif i[0]==1 and i[1]==0 and n==1:\n print(0)\n exit()\n else:\n print(-1)\n exit()\n \nif num[0]==0:\n print(-1)\nelif ...
['Runtime Error', 'Accepted']
['s543418808', 's359515818']
[8956.0, 9204.0]
[29.0, 29.0]
[470, 461]
p02762
u002539468
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['n, m, k = map(int, input().split())\n\ncandidates = [0] * n\nfriends = [set() for _ in range(n)]\nblocks = [set() for _ in range(n)]\nparent = [i for i in range(n)]\nsizes = [1 for _ in range(n)]\n\ndef root(x):\n global parent\n if parent[x] == x:\n return x\n else:\n parent[x] = root(parent[x...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s486679360', 's660307691', 's768618086', 's862416220', 's833277703']
[80732.0, 80760.0, 68920.0, 68952.0, 41420.0]
[1545.0, 1426.0, 989.0, 1047.0, 1229.0]
[1001, 1054, 999, 1003, 1162]
p02762
u004423772
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(2147483647)\ndef dfs(v, seen, overall, connected_components):\n seen[v] = True\n connected_components.add(v)\n for nv in overall[v]:\n if seen[nv] == True:continue\n dfs(nv, seen, overall, connected_components)\ndef main():\n N, M...
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s157585530', 's387317417', 's167986664']
[1805052.0, 19156.0, 106984.0]
[2214.0, 77.0, 937.0]
[1193, 531, 833]
p02762
u046187684
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["class UnionFind:\n\n def __init__(self, n):\n self.t = [-1] * (n + 1)\n\n def flatten(self):\n for i, _ in enumerate(self.t):\n self.find_root(i)\n\n def union(self, a, b):\n ra = self.find_root(a)\n rb = self.find_root(b)\n if ra != rb:\n self.t[max(r...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s621818920', 's737533757', 's077330132']
[70452.0, 49012.0, 70376.0]
[546.0, 449.0, 491.0]
[1271, 924, 1272]
p02762
u054556734
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import numpy as np\nimport scipy.sparse as sps\nimport scipy.misc as spm\nimport collections as col\nimport functools as func\nimport itertools as ite\nimport fractions as frac\nimport math as ma\nfrom math import cos,sin,tan,sqrt\nimport cmath as cma\nimport copy as cp\nimport sys\nimport re\nimport bisect as bs\nsy...
['Runtime Error', 'Accepted']
['s994115197', 's105570667']
[57512.0, 47456.0]
[340.0, 722.0]
[1720, 2103]
p02762
u070201429
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['n, m, k = map(int, input().split())\n\nfriend = [[] for _ in range(n)]\nblock = [[] for _ in range(n)]\n\nfor _ in range(m):\n a, b = map(int, input().split())\n friend[a-1].append(b-1)\n friend[b-1].append(a-1)\nfor _ in range(k):\n c, d = map(int, input().split())\n block[c-1].append(d-1)\n block[...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s049120545', 's205113483', 's547203336', 's462231920']
[43312.0, 41368.0, 41456.0, 18004.0]
[2107.0, 2110.0, 2106.0, 821.0]
[1051, 1145, 1145, 1718]
p02762
u074372598
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["from collections import defaultdict\nclass UnionFind:\n def __init__(self, n=0):\n self.d = [-1 for _ in range(n)]\n \n def find(self, x): # find root\n if self.d[x] < 0: return x\n self.d[x] = self.find(self.d[x])\n return self.d[x]\n\n def unite(self, x, y):\n x, y = s...
['Wrong Answer', 'Accepted']
['s010149327', 's474674221']
[34492.0, 34016.0]
[1264.0, 1242.0]
[1370, 1353]
p02762
u089142196
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['def BFS(x):\n cnt=1\n v=deque([x])\n k=0\n zu[x]=k\n lis=[x]\n \n while len(v)>0:\n a=v.popleft()\n for i in fr[a]:\n if zu[i]==-1:\n zu[i]=zu[a]+1\n v.append(i)\n cnt += 1\n lis.append(i)\n \n return lis\n\n##############################\n\nfrom collections imp...
['Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s104962091', 's194765257', 's320840086', 's512261748', 's416845631']
[74004.0, 70568.0, 374688.0, 72276.0, 108104.0]
[1087.0, 2108.0, 2127.0, 1173.0, 1769.0]
[1199, 772, 737, 738, 1134]
p02762
u094191970
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["from sys import stdin\nnii=lambda: map(int, stdin.readline().split())\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.par...
['Time Limit Exceeded', 'Accepted']
['s076681971', 's652618749']
[51244.0, 46844.0]
[2106.0, 979.0]
[1662, 1077]
p02762
u111473084
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['# import numpy as np\nclass UnionFind:\n def __init__(self, n):\n # self.parent = np.array([-1] * n)\n # self.size = np.array([1] * n)\n self.parent = [-1] * n\n self.size = [0] * n\n def find(self, x):\n if self.parent[x] == -1:\n return x\n else:\n ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s421845934', 's608193932', 's774894750', 's830424160', 's105793548']
[44708.0, 45540.0, 40924.0, 43404.0, 75248.0]
[1130.0, 968.0, 649.0, 857.0, 1177.0]
[1108, 1126, 1132, 1128, 1069]
p02762
u113971909
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\nclass UnionFind():\n def __init__(self, n): \n self.n = n\n \n self.parents = [i for i in range(n)]\n \n self.ranks = [0] * n\n \n self.sizes = [1] * n\n\n def find(self, x): \n if self.parents[x...
['Wrong Answer', 'Accepted']
['s389268013', 's541743654']
[84020.0, 69360.0]
[2108.0, 1496.0]
[2391, 2466]
p02762
u149752754
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['class UnionFind():\n def __init__(self,size): \n self.table = [-1 for _ in range(size)]\n self.cou = [1 for _ in range(size)]\n def find(self,x): \n if self.table[x] < 0:\n return x\n else:\n self.table[x] = self.find(self.table[x])\n return self.tabl...
['Wrong Answer', 'Accepted']
['s027823983', 's043489704']
[33104.0, 40376.0]
[1256.0, 1321.0]
[1458, 1482]
p02762
u169501420
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["# -*- coding: utf-8 -*-\n\n#def find_friend(tree_node, target):\n# for friend in tree_node.friends:\n# if target in friend.friend_numbers:\n# return True\n#\n# flags = []\n# for friend in tree_node.friends:\n# flags.append(find_friend(friend, target))\n# if True in flags:\n# ...
['Wrong Answer', 'Accepted']
['s183297516', 's099756017']
[125932.0, 41904.0]
[2111.0, 1207.0]
[2532, 1999]
p02762
u185325486
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["from collections import defaultdict\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self....
['Wrong Answer', 'Accepted']
['s525195819', 's634182435']
[3316.0, 36792.0]
[21.0, 1307.0]
[1271, 1183]
p02762
u187516587
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import sys\nN,M,K=map(int,input().split())\ns=[[]for i in range(N)]\ntn=[0]*N\nsys.setrecursionlimit(200000)\nfor i in range(M):\n a,b=map(int,input().split())\n s[a-1].append(b)\n s[b-1].append(a)\n tn[a-1]+=1\n tn[b-1]+=1\nl=[None]*N\ndef hu(n,t):\n for i in s[n]:\n if l[i-1]==None:\n ...
['Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s190604772', 's351181635', 's976840811', 's937856328']
[46528.0, 46528.0, 9392.0, 13340.0]
[1064.0, 1055.0, 2104.0, 853.0]
[609, 610, 702, 936]
p02762
u196746947
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import queue\nimport numpy\ndef main():\n n,m,k=map(int,input().split())\n root=numpy.array([numpy.zeros(n) for i in range(n)])\n for i in range(n):\n root[i][i]=2\n for i in range(m):\n a,b=map(int,input().split())\n root[a-1][b-1]=1\n root[b-1][a-1]=1\n for i in range(k):\...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s118618533', 's311490367', 's406292489', 's542812479', 's585887121', 's838833356', 's995759534', 's285237366']
[1901824.0, 58824.0, 1901840.0, 4080.0, 3064.0, 3064.0, 3188.0, 49072.0]
[2456.0, 2106.0, 2358.0, 29.0, 20.0, 17.0, 19.0, 1693.0]
[2515, 1658, 2537, 1272, 1660, 2511, 1660, 1825]
p02762
u210827208
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['def find(x):\n if par[x]<0:\n return x\n else:\n par[x]=find(par[x])\n return par[x]\n\ndef unite(x,y):\n x,y=find(x),find(y)\n if x!=y:\n if x>y:\n x,y=y,x\n par[x]+=par[y]\n par[y]=x\n \ndef same(x,y):\n return find(x)==find(y)\n\ndef size(x):\n return-par[find(x)]\...
['Runtime Error', 'Accepted']
['s957046051', 's603240280']
[60008.0, 76756.0]
[789.0, 1262.0]
[750, 751]
p02762
u212786022
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['class UnionFind(object):\n def __init__(self, n=0):\n self.par = [i for i in range(n)]\n self.rank = [-1 for _ in range(n)]\n \n def find(self, x):\n if self.rank[x] < 0:\n return x\n else:\n self.rank[x] = self.find(self.rank[x])\n return self...
['Runtime Error', 'Accepted']
['s745710014', 's524812235']
[27824.0, 35052.0]
[898.0, 1376.0]
[1089, 1192]
p02762
u250583425
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["import sys\nfrom collections import defaultdict\ndef input(): return sys.stdin.readline().rstrip()\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n + 1\n self.parents = [-1] * (n + 1)\n self.mem = [[] for _ in range(n+1)]\n\n def find(self, x):\n if self.parents[x] < 0:\n ...
['Wrong Answer', 'Accepted']
['s080239171', 's829580962']
[69492.0, 32372.0]
[2108.0, 859.0]
[1805, 1359]
p02762
u255382385
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['n, m, k = map(int, input().split())\nfriends = [[] * n for i in range(n)]\nfor _ in range(m):\n num_from, num_to = map(int, input().split())\n friends[num_from - 1].append(num_to - 1)\n friends[num_to - 1].append(num_from - 1)\n\nblocks = [[] * n for i in range(n)]\nfor _ in range(k):\n num_from, num_to =...
['Runtime Error', 'Accepted']
['s722113167', 's104796213']
[41960.0, 33300.0]
[2106.0, 1203.0]
[1046, 1295]
p02762
u257162238
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import bisect\n\n\nclass UnionFind():\n \n def __init__(self, n):\n self.n = next\n self.parent = [-1 for i in range(n)]\n \n def find(self, x):\n if self.parent[x] < 0:\n return x\n else:\n self.parent[x] = self.find(self.parent[x])\n return se...
['Wrong Answer', 'Accepted']
['s522290848', 's627305154']
[60396.0, 63932.0]
[1367.0, 1525.0]
[1931, 1792]
p02762
u268181283
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y)...
['Wrong Answer', 'Accepted']
['s641281374', 's173109795']
[34452.0, 14116.0]
[2105.0, 1078.0]
[1472, 1500]
p02762
u268318377
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['N, M, K = map(int, input().split())\nans = [0] * (N + 1)\nchild = {i:[] for i in range(1, N+1)}\ngroup_id = {i:[] for i in range(1, N+1)}\ngroup = {}\nisChecked = [0] * (N + 1)\n\nfor _ in range(M):\n a, b = map(int, input().split())\n child[a].append(b)\n child[b].append(a)\n \nX = []\ng = 0\ni = 1\nwhil...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s834293813', 's948440075', 's206523007']
[140276.0, 73784.0, 73012.0]
[2106.0, 1170.0, 1043.0]
[1004, 774, 761]
p02762
u278356323
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["# ABC157d\n\n\ndef main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n \n\n class UnionFind:\n def __init__(self, n):\n self.tree = [i for i in range(n)]\n self.member = [1]*n\n\n def root(self, x):\n if(self.tree[x] == x):\n...
['Wrong Answer', 'Accepted']
['s164304545', 's384488502']
[99984.0, 98292.0]
[1381.0, 1142.0]
[1593, 1594]
p02762
u298633786
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["import numpy as np\n\nN, M, K = map(int, input().split(' '))\n\nfriend_graph = np.zeros((N, N), dtype=np.uint8)\nfor _ in range(M):\n a, b = map(int, input().split(' '))\n friend_graph[a-1, b-1] = 1\n friend_graph[b-1, a-1] = 1\n\nblock_graph = np.zeros((N, N), dtype=np.uint8)\nfor _ in range(K):\n c, d =...
['Runtime Error', 'Accepted']
['s833437682', 's597633060']
[1575300.0, 52612.0]
[1432.0, 1792.0]
[1517, 1198]
p02762
u303039933
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['# -*- coding: utf-8 -*-\nimport sys\nimport math\nimport os\nimport itertools\nimport string\nimport heapq\nimport _collections\nfrom collections import Counter\nfrom collections import defaultdict\nfrom collections import deque\nfrom functools import lru_cache\nimport bisect\nimport re\nimport queue\nimport decimal\...
['Runtime Error', 'Accepted']
['s470685626', 's981579336']
[5656.0, 78868.0]
[51.0, 1206.0]
[4002, 4004]
p02762
u312907447
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
['import sys\n\nsys.setrecursionlimit(10 ** 7)\n\ndef dfs(x, seen):\n seen.add(x)\n for i in G[x]:\n if i in seen:\n continue\n dfs(i, seen)\n\nN, M, K = map(int, input().split())\n\n\nS = set()\n\nG = [[] for i in range(N)]\n\nfor _ in range(M):\n A, B = map(int, input().split())\n G[A-1].append(B-1)\n ...
['Runtime Error', 'Accepted']
['s053388093', 's757757900']
[57940.0, 83704.0]
[2022.0, 1188.0]
[1050, 731]
p02762
u318127926
2,000
1,048,576
An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M _friendships_ and K _blockships_. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User...
["n, m, k = map(int, input().split())\n\nfriends = [[] for _ in range(n+1)]\nblocks = [[] for _ in range(n+1)]\n\nfor _ in range(m):\n a, b = map(int, input().split())\n friends[a].append(b)\n friends[b].append(a)\n\nfor _ in range(k):\n c, d = map(int, input().split())\n blocks[c].append(d)\n blocks[...
['Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s080460017', 's099710095', 's101562981', 's561358180', 's730153620', 's812356075']
[64996.0, 68240.0, 48616.0, 67060.0, 52812.0, 47188.0]
[2111.0, 2107.0, 806.0, 2108.0, 2110.0, 1112.0]
[842, 1165, 836, 956, 899, 1038]