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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03805 | u101350975 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nn, m = map(int, input().split())\npath = [[False] * n for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n path[a][b] = True\n path[b][a] = True\nans = 0\nfor i itertools.permutations(range(n), n):\n if i[0] == 0:\n for j in range(n):... | ['Runtime Error', 'Accepted'] | ['s915390436', 's649298485'] | [8960.0, 9212.0] | [21.0, 38.0] | [453, 456] |
p03805 | u102655885 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from collections import defaultdict\nn, m = map(lambda x: int(x), input().split())\n\nlinks = defaultdict(set)\n\nfor _ in range(m):\n a, b = map(lambda x: int(x), input().split())\n links[a].add(b)\n links[b].add(a)\n \npath_counter = 0\n \ndef path_patterns_number(current_node, remaining_nodes):#, re... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s547126462', 's747462476', 's904741739', 's913488582', 's280278451'] | [9228.0, 9068.0, 9392.0, 26964.0, 9400.0] | [38.0, 24.0, 33.0, 116.0, 40.0] | [924, 931, 35, 12, 879] |
p03805 | u103902792 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m = map(int,input().split())\ngraph = {i+1:[] for i in range(n)}\nfor _ in range(m):\n a,b = map(int,input(),split())\n graph[a].append(b)\n graph[b].append(a)\n\ncount = 0\ndef func(path,p):\n if len(path) == n:\n count += 1\n return\n for i in graph[p]:\n if i in path:\n continue\n func(path... | ['Runtime Error', 'Accepted'] | ['s757295658', 's869367241'] | [3064.0, 3064.0] | [20.0, 27.0] | [323, 359] |
p03805 | u112317104 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = map(int, input().split())\nA = [list(map(int, input().split())) for _ in range(N)]\n\nvisited = [False] * N\nvisited[0] = True\nd = {}\nfor a, b in A:\n d.setdefault(a, []).append(b)\n d.setdefault(b, []).append(a)\n\nl = sorted(d.items())\n\n# print(d)\ndef dfs(v, c):\n if visited[v-1]: return 0\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s882828688', 's934634038', 's984487045'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 23.0] | [595, 595, 485] |
p03805 | u119655368 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nl = [list(map(int, input().split())) for i in range(m)]\nr = [[] for i in range(n + 1)]\nans = 0\nfor i in range(m):\n r[l[i][0]].append(l[i][1])\n r[l[i][1]].append(l[i][0])\np = []\nfor i in range(n):\n p.append(i + 1)\np = list(itertools.permutations(p))\nfor i in range(l... | ['Runtime Error', 'Accepted'] | ['s329791591', 's609909644'] | [3064.0, 3572.0] | [18.0, 46.0] | [524, 495] |
p03805 | u125205981 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\ndef path(n):\n l = len(n)\n i = 0\n while i < l - 1:\n a = n[i]\n b = n[i + 1]\n\n if a < b:\n c = (a, b)\n else:\n c = (b, a)\n\n for m in C:\n if m == c:\n break\n else:\n return False\n... | ['Runtime Error', 'Accepted'] | ['s146658656', 's917982191'] | [3188.0, 3064.0] | [34.0, 54.0] | [608, 595] |
p03805 | u127499732 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["def main():\n _, __ = map(int, input().split())\n ___ = [[] for _ in range(_)]\n for _ in range(__):\n ____, _____ = map(lambda ______: int(_____) - 1, input().split())\n ___[____].append(_____)\n ___[_____].append(____)\n\n _______ = [False] * _\n ________ = ___________(0, ___, __... | ['Runtime Error', 'Accepted'] | ['s493526910', 's471630725'] | [3064.0, 3320.0] | [18.0, 24.0] | [722, 885] |
p03805 | u131881594 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools as it\nn,m=map(int,input().split())\npath={[] for _ in range(m)}\nfor i in range(m): path[i]=list(map(int,input().split()))\nls=list(it.permutations(range(1,n+1)))\ncnt=0\nfor l in ls:\n if l[0]==1: break\n for i in range(n-1):\n if [i,i+1] in path: cnt+=1\nprint(cnt)', 'import itertools... | ['Runtime Error', 'Accepted'] | ['s320464368', 's200997795'] | [9208.0, 13900.0] | [23.0, 69.0] | [288, 379] |
p03805 | u134520518 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn, m = map(int, input().split())\n\ntu = [[] for j in range(n+1)]\n\nfor i in range(m):\n a, b = map(int, input().split())\n tu[a].append(b)\n tu[b].append(a)\n\nna = [i for i in range(2,n+1)]\nans = 0\n\n\nprint(permutations(na))\nfor nara in permutations(na):\n st =... | ['Wrong Answer', 'Accepted'] | ['s350434616', 's678526588'] | [3064.0, 3064.0] | [30.0, 30.0] | [466, 442] |
p03805 | u139112865 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['#054_C\nfrom itertools import permutations\nn,m=map(int,input().split())\nedges=[[False for _ in range(n)] for _ in range(n)]\nfor _ in range(m):\n a,b=map(int,input().split())\n a,b=a-1,b-1\n edges[a][b]=edges[b][sa]=True\n\nans=0\nfor l in permutations(range(1,n),n-1):\n l=[0]+list(l)\n if all(edges[... | ['Runtime Error', 'Accepted'] | ['s889864554', 's177958250'] | [3064.0, 3064.0] | [17.0, 29.0] | [367, 366] |
p03805 | u140251125 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['# input\nN, M = map(int, input().split())\nG = [list(map(int, input().split())) for _ in range(M)]\nedges = [set() for _ in range(N)]\n\nfor a, b in G:\n edges[a - 1].add((b - 1, 1))\n edges[b - 1].add((a - 1, 1))\n\ndef dfs(start, edges, path):\n path.append(start)\n if len(path) == n:\n path.pop(... | ['Runtime Error', 'Accepted'] | ['s657224927', 's906310852'] | [3188.0, 3064.0] | [18.0, 27.0] | [488, 492] |
p03805 | u143492911 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nedges=[[] for _ in range(n)]\nfor i in range(m):\n a,b=map(int,input().split())\n edges[a-1]+=[b-1]\n edges[b-1]+=[a-1]\nvis=[1]+[0]*(n-1)\n\ndef dfs(v):\n if vis==[1]*n:\n return 1\n count=0\n for i in edges[v]:\n if vis[i]==0:\n vis[i]=1\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s418173602', 's971961629', 's982173634', 's226732407'] | [3064.0, 3060.0, 4212.0, 3064.0] | [24.0, 17.0, 31.0, 36.0] | [398, 432, 450, 483] |
p03805 | u151625340 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\ndict = {}\nfor m in range(M):\n a,b = map(int,input().split())\n if a in dict:\n dict[a].append(b)\n else:\n dict[a] = [b]\n if b in dict:\n dict[b].append(a)\n else:\n dict[b] = [a]\nans = 0\nl = [0 for i in range(N+1)]\nl[1] = 1\ndef dfs(l,n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s696055502', 's809728280', 's094276676'] | [3824.0, 3188.0, 3064.0] | [58.0, 18.0, 27.0] | [583, 577, 565] |
p03805 | u156163787 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn,m=map(int,input().split())\nes=set()\nfor _ in range(m):\n u,v=map(int,input().split())\n es|={(u-1,v-1),(v-1,u-1)}\n\nprint(sum(all((u,v) in es for u,v in zip(p,p[1:]))\n for p in permutations(range(n)) if p[0]))\n', 'from itertools import permutations\n\nn,m=ma... | ['Wrong Answer', 'Accepted'] | ['s157034216', 's271937091'] | [3060.0, 3060.0] | [80.0, 29.0] | [260, 263] |
p03805 | u166201488 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nN, M = map(int, input().split())\np = [list(map(int, input().split())) for i in range(M)]\nv = list(map(list, itertools.permutations(range(1,N+1), N)))\ncnt = 0\nfor i in range(len(v)):\n for j in range(N-1):\n #print((i,j))\n \n if v[i][j:j+2] in p:\n cnt += 1\npr... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s603733274', 's791786160', 's460755173'] | [12276.0, 3060.0, 3828.0] | [285.0, 18.0, 56.0] | [341, 360, 363] |
p03805 | u183896397 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = (int(i) for i in input().split())\nK = []\nfor i in range(M):\n J = [int(i) for i in input().split()]\n J.sort()\n K.append(J)\n\n\nvertex = []\nfor i in range(N-1):\n vertex.append(i+2)\n\nX = list(itertools.permutations(vertex))\n\n\nans = 0\nfor i in X:\n start = 1\n localcount = 0\n for... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s453090378', 's589965427', 's041521721'] | [3064.0, 3064.0, 3572.0] | [17.0, 18.0, 50.0] | [627, 587, 603] |
p03805 | u186838327 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nl = [[] for _ in range(m)]\nfor i in range(m):\n a, b = map(int, input().split())\n l[a-1].append(b-1)\n l[b-1].append(a-1)\n\nimport itertools\nans = 0\nfor p in itertools.permutations(range(n)):\n if p[0] == 0:\n flag = 1\n for i in range(n-1):\n if ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s046744504', 's917491591', 's593071237'] | [3188.0, 3064.0, 9020.0] | [37.0, 94.0, 30.0] | [433, 434, 518] |
p03805 | u191829404 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from collections import defaultdict\nfrom collections import deque\n\nN, M = map(int, input().split())\n\ngraph = defaultdict(list)\nedges = []\n\n\nfor _ in range(M):\n a, b = map(int, input().split())\n graph[a].append(b)\n graph[b].append(a)\n edges.append((a, b))\n\nans = 0\n\ndef dfs(graph, node_star... | ['Wrong Answer', 'Accepted'] | ['s967081405', 's018737024'] | [3692.0, 3316.0] | [65.0, 44.0] | [661, 642] |
p03805 | u201802797 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nnim,mike = list(map(int,input().split()))\narray = [list(map(int,input().split())) for i in range(mike)]\ncounter = 0\nfor i in permutations(range(1,nim+1)):\n boo = True\n if i[0]==1:\n for i in range(nim-1):\n if sorted([i[i],i[i+1]]) not in array:\n boo = Fals... | ['Runtime Error', 'Accepted'] | ['s144085238', 's478825411'] | [3064.0, 3064.0] | [18.0, 60.0] | [353, 517] |
p03805 | u203377003 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = list(map(int, input().split()))\n\nG = {}\nfor m in range(M):\n k, v = list(map(int, input().split()))\n G.setdefault(k, []).append(v)\n G.setdefault(v, []).append(k)\n # G[k] = list(set(G[k]))\n # G[v] = list(set(G[v]))\n\ncount = 0\nvisited = []\nvisited.append(1)\nhistory = []\n\n\ndef dfs(gr... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s330587927', 's767991566', 's785311688'] | [3064.0, 3316.0, 3064.0] | [19.0, 52.0, 28.0] | [729, 609, 453] |
p03805 | u210827208 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\n\nX=[[] for _ in range(n)]\n\nfor i in range(m):\n a,b=map(int,input().split())\n X[a-1].append(b-1)\n X[b-1].append(a-1)\n\nprint(X)\n\npath=[i for i in range(2,n+1)]\n\nvisited=[1]+[0]*(n-1)\n\ndef dfs(v):\n if visited==[1]*n:\n return 1\n res=0\n for x in X[v]... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s333908316', 's721240601', 's642530267'] | [3444.0, 3064.0, 3064.0] | [51.0, 27.0, 27.0] | [457, 430, 421] |
p03805 | u214434454 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int,input().split())\nlis = [0 for i in range(m)]\nfor i in range(m):\n lis[i] = list(map(int,input().split()))\n \nseen = []\ncount = 0\nvisited = [0 for i in range(m)]\nr = 0\ndef route(x=1):\n for i in range(m):\n if lis[i][0] == x and visited[i] == 0:\n visited[i] = 1\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s577735839', 's938787218', 's123387330'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 67.0] | [703, 648, 621] |
p03805 | u217627525 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\npaths=[]\nfor i in range(n):\n paths.append([0]*n)\nfor i in range(m):\n a,b=map(int,input().split())\n paths[a-1][b-1]=1\n paths[b-1][a-1]=1\nvisited=[0]*n\n\ndef dfs(now,depth):\n if visited[now]==1:\n return 0\n elif depth==n-1:\n return 1\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s359628227', 's862312380'] | [3832.0, 3064.0] | [74.0, 40.0] | [527, 499] |
p03805 | u218843509 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = list(map(int, input().split()))\npaths = [list(map(int, input().split())) for _ in range(m)]\n\nvisited = [1]\nrest = [i for i in range(2, n + 1)]\nans = 0\n\ndef dfs(num):\n if rest == []:\n print(visited)\n global ans\n ans += 1\n for i in range(m):\n if num in paths[i]:\n ... | ['Wrong Answer', 'Accepted'] | ['s415022711', 's901302914'] | [3188.0, 3064.0] | [92.0, 82.0] | [647, 649] |
p03805 | u221061152 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nab = []\nfor _ in range(n):\n a,b=map(int,input().split())\n a,b=a-1,b-1\n ab.append({a,b})\nimport itertools\n\ncnt = 0\nfor v in itertools.permutations(range(1,n)):\n l = 0\n ok = True\n for v2 in v:\n if {l,v2} not in ab:\n ok = False\n break\n l = v2\n if ok:\n... | ['Runtime Error', 'Accepted'] | ['s341710144', 's279351646'] | [9196.0, 9212.0] | [32.0, 39.0] | [339, 340] |
p03805 | u223646582 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nN, M = map(int, input().split())\n\nG = {k: set() for k in range(N+1)}\nfor _ in range(M):\n a, b = map(int, input().split())\n \n G[a].add(b)\n G[b].add(a)\nprint(G)\n\nans = 0\nfor p in itertools.permutations(range(2, N+1)):\n print(p)\n c = 1\n for n in p:\n if n not i... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s071962596', 's084050858', 's810578308'] | [3188.0, 3064.0, 3064.0] | [31.0, 17.0, 33.0] | [398, 470, 405] |
p03805 | u227082700 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nedge=[n*[0]for _ in range(n)]\nfor i in range(m):\n\ta,b=map(int,input().split())\n\ta-=1\n\tb-=1\n\tedge[a][b]=edge[b][a]=1\nfrom itertools import permutations\nans=0\nfor i in permutations([j for j in range(1,n)],n-1):\n\tf=True\n\tt=[0]+i\n\tfor j in range(1,n):\n\t\tif edge[t[j-1]][t... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s684873941', 's689873186', 's303957688'] | [3064.0, 3064.0, 3064.0] | [17.0, 486.0, 31.0] | [335, 534, 341] |
p03805 | u228223940 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import bisect\nn,m = map(int,input().split())\n\ng = [[ ] for i in range(n+1)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n g[a].append(b)\n g[b].append(a)\n\n \n #g[a][] = b\n #g[a].append(b)\n #g[b].append(a)\n\n#g[4].sort()\n \nans = 0\n\ndef dfs(x,check):\n #print(check,x)\n... | ['Wrong Answer', 'Accepted'] | ['s143004704', 's438210799'] | [3700.0, 3064.0] | [28.0, 24.0] | [737, 738] |
p03805 | u247554097 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\n\nN, M = map(int, input().split())\nNeighbor_list = [[] for _ in range(N)]\nfor _ in range(M):\n s, t = map(int, input().split())\n Neighbor_list[s-1].append(t-1)\n Neighbor_list[t-1].append(s-1)\n\n\ndef dfs(cur, path):\n if len(path) == N:\n return 1\n else:\n ret = 0\n for nei... | ['Wrong Answer', 'Accepted'] | ['s055024297', 's651500148'] | [3064.0, 3064.0] | [89.0, 27.0] | [662, 663] |
p03805 | u248967559 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import copy\n\nN, M = [ int(x) for x in input().split()]\n\nclass Node:\n def __init__(self, id):\n self.id = id\n self.path = []\n self.passed = False\n def __str__(self):\n return "id: " + str(self.id) + " path: " + str(self.path) + " passed: " + str(self.passed)\n\nnodes = []\nfor... | ['Wrong Answer', 'Accepted'] | ['s072190468', 's271978044'] | [4052.0, 3572.0] | [2104.0, 120.0] | [1015, 881] |
p03805 | u252405453 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def abc054c_one_stroke_path():\n import itertools\n n, m = map(int, input().split())\n e = [set() for _ in range(n + 1)]\n for _ in range(m):\n a, b = map(int, input().split())\n e[a].add(b)\n e[b].add(a)\n pattern = itertools.permutations(range(2, n + 1))\n cnt = 0\n for p i... | ['Wrong Answer', 'Accepted'] | ['s677139927', 's378656986'] | [9068.0, 9212.0] | [23.0, 31.0] | [491, 519] |
p03805 | u255280439 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n\nsys.setrecursionlimit(1000000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(', '.join(\n names.get... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s521022554', 's822906979', 's319759653'] | [4872.0, 5140.0, 4872.0] | [92.0, 95.0, 54.0] | [3613, 3612, 3614] |
p03805 | u282228874 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn,m = map(int,input().split())\nD = [[0]*n for i in range(n)]\nfor i in range(m):\n\ta,b = map(int,input().split())\n\tD[a-1][b-1] = 1\n\tD[b-1][a-1] = 1\nprint(D)\n\ncnt = 0\nfor a in permutations(range(n)):\n\tprint(a)\n\tif a[0] != 0:\n\t\tbreak\n\ttmp = 1\n\tfor i in range(n-... | ['Wrong Answer', 'Accepted'] | ['s294297356', 's228624862'] | [3188.0, 3064.0] | [39.0, 25.0] | [349, 344] |
p03805 | u304058693 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools as it\n\nn, m = map(int, input().split())\na = list(list(map(int, input().split())) for _ in range(m))\n\nprint(a)\n\n\nfor i in range(len(a)):\n a.append([a[i][1],a[i][0]])\nprint(a)\n\n\n\nlis = list(it.permutations(range(2, n + 1)))\n#print(lis)\nfor i in range(len(lis)):\n lis[i] = (1,) + ... | ['Wrong Answer', 'Accepted'] | ['s976182140', 's317036395'] | [10280.0, 10172.0] | [464.0, 65.0] | [831, 770] |
p03805 | u314057689 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from copy import deepcopy as dcopy\ndef main():\n global count,N,M,edges,stack\n N, M = map(int, input().split())\n edges = [[0]*N for n in range(N)]\n for m in range(M):\n a,b = map(lambda x:int(x)-1,input().split())\n edges[a][b] = 1\n edges[b][a] = 1\n\n count = 0\n stack = [... | ['Wrong Answer', 'Accepted'] | ['s290953265', 's269246091'] | [3544.0, 3544.0] | [24.0, 923.0] | [968, 1082] |
p03805 | u318233626 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["from sys import setrecursionlimit\nsetrecursionlimit(10 ** 10)\nn, m = map(int, input().split())\nP = [[] for i in range(m)] #Pass\nfor i in range(m):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1 \n P[a].append(b)\n P[b].append(a)\n#print(P)\n\nc = 0 #cursol\nR = [0 for i in range(m)] #R... | ['Runtime Error', 'Accepted'] | ['s434121574', 's017865124'] | [8988.0, 9192.0] | [21.0, 36.0] | [961, 960] |
p03805 | u322229918 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nimport numpy as np\nN, M = map(int, input().split(" "))\nmat = [[0] * n for _ in range(n)]\nfor _ in range(M):\n v1, v2 = map(int, input().split(" "))\n mat[v1 - 1][v2 - 1] = mat[v2 - 1][v1 - 1] = 1\n\ncount = 0\nfor line in permutations(np.arange(N - 1) + 2):\n vtxs = [1]... | ['Runtime Error', 'Accepted'] | ['s610820984', 's954689092'] | [21800.0, 12428.0] | [312.0, 518.0] | [495, 431] |
p03805 | u338597441 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools as it\n\nn,m=map(int,input().split())\nans=[]\nfor i in range(n):\n a,b=map(int,input().split())\n ans.append([a,b])\n ans.append([b,a])\n \n\nfor e in it.permutations(range(n)):\n count,a=0,0\n if e[0]!=0:\n break\n \n for i in range(len(e)-1):\n if [e[i]+1,e[i+1]... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s038260829', 's305547396', 's497799678'] | [9068.0, 9152.0, 9128.0] | [51.0, 35.0, 69.0] | [407, 426, 435] |
p03805 | u359358631 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\n\ndef main():\n N, M = map(int, input().split())\n node_lst = [x for x in range(N)]\n edge_lst = [list(map(int, input().split())) for _ in range(M)]\n ans = 0\n print(edge_lst)\n\n for route in itertools.permutations(node_lst):\n is_visited = [False] * N\n is_visite... | ['Wrong Answer', 'Accepted'] | ['s198683084', 's608711699'] | [9100.0, 9204.0] | [82.0, 84.0] | [806, 786] |
p03805 | u360515075 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['input()', 'from collections import defaultdict\nfrom collections import deque\n\nN, M = map(int, input().split())\n\nD = defaultdict(list)\nfor i in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n D[a].append(b)\n D[b].append(a)\n\nq = deque([])\nq.append(0)\n\nans = 0\ndef dfs(n, q):\n print (... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s527632156', 's948644803', 's135563824'] | [2940.0, 3956.0, 3316.0] | [17.0, 69.0, 30.0] | [7, 464, 443] |
p03805 | u367130284 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import collections as c\nn,m=map(int,input().split())\nd=c.defaultdict(list)\nfor s in range(m):\n a,b=map(int,input().split())\n d[a].append(b)\nprint(d)\nans=0\nmovecount=0\ndef search(defaultdict,list):\n global movecount\n global ans\n movecount+=1\n if list==[]:\n if movecount==m:\n ans+=1\n m... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s767920648', 's960441999', 's233817741'] | [3316.0, 3316.0, 3316.0] | [21.0, 28.0, 28.0] | [482, 635, 456] |
p03805 | u370852395 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["# -*- coding: utf-8 -*-\nN,M = map(int, input().split())\nG = [[] for j in range(N)]\n\nfor i in range(M):\n a,b = map(int, input().split())\n G[a-1].append(b-1)\n G[b-1].append(a-1)\nprint(G)\nvisited = [False]*N\nvisited[0] = True\n\ndef DFS(v,visited):\n \n if all(visited):\n return 1\n an... | ['Wrong Answer', 'Accepted'] | ['s087947525', 's682167924'] | [9236.0, 9120.0] | [58.0, 28.0] | [578, 548] |
p03805 | u373958718 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import sys\nsys.setrecursionlimit(10 ** 6)\nn,m=map(int,input().split())\ng=[[]for i in range(n)]; ans=0\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1; b-=1\n g[a].append(b)\n g[b].append(a)\n# print(g)\ndef dfs(x,visited):\n global ans\n # print(x,visited)\n for p in g[x]:\n if visited[p]==0:\n... | ['Wrong Answer', 'Accepted'] | ['s457522554', 's166467833'] | [3064.0, 3064.0] | [17.0, 24.0] | [477, 477] |
p03805 | u375616706 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["def bit_dp(N, Adj):\n dp = [[0]*N for i in range(1 << N)]\n #dp[{0},0] = 1\n\n dp[1][0] = 1\n\n for S in range(1 << N):\n for v in range(N):\n \n if (S & (1 << v)) == 0:\n continue\n\n \n sub = S ^ (1 << v)\n\n for u in range(N):... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s096847948', 's706311117', 's432482125'] | [3064.0, 3064.0, 3064.0] | [18.0, 19.0, 20.0] | [923, 927, 915] |
p03805 | u375695365 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nab=[]\nfor i in range(m):\n ab.append(list(map(int,input().split())))\n\nans=0\ndef dfs(start,finish):\n global ans\n finish.add(start)\n # print(finish)\n if len(finish)==n:\n ans+=1\n \n for i in adlist[start-1]:\n if i not in finish:\n # ... | ['Wrong Answer', 'Accepted'] | ['s948124823', 's496591304'] | [3064.0, 3444.0] | [18.0, 36.0] | [699, 1047] |
p03805 | u379559362 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\n\nn, m = map(int, input().split())\nroad = [[0] * n for i in range(n)]\n\ngraph = [[] for i in range(n)]\nfor j in range(m):\n x, y = map(int, input().split())\n road[x - 1][y - 1] += 1\n road[y - 1][x - 1] += 1\n graph[x-1].append(y-1)\n graph[y-1].append(x-1)\n#print(road)\n#print... | ['Wrong Answer', 'Accepted'] | ['s241092502', 's631717092'] | [3064.0, 3064.0] | [30.0, 41.0] | [905, 922] |
p03805 | u390727364 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(g, seen, n, ans):\n all_seen = True\n\n for si in seen:\n if si == False:\n all_seen = False\n\n if all_seen:\n ans += 1\n return ans\n\n for m in g[n]:\n if seen[m]:\n continue\n\n seen[m] = True\n ans = dfs(g, seen, m, ans)\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s499821726', 's917800470', 's297652111'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 26.0] | [746, 713, 737] |
p03805 | u390958150 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m = map(int,input().split())\ngraph = [[0]*(n) for i in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n graph[a-1][b-1] = graph[b-1][a-1] = 1\n\nprint(graph)\nvisited = [True] + [False]*(n-1)\nans = 0\n\n\ndef dfs(x):\n global ans\n global visited\n \n if all(visited):\n ... | ['Wrong Answer', 'Accepted'] | ['s692796947', 's757128440'] | [3064.0, 3064.0] | [33.0, 33.0] | [505, 493] |
p03805 | u408760403 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M=map(int,input().split())\ntbl=[[0]*(N+1) for _ in range(N+1)]\nfor i in range(M):\n a,b=map(int,input().split())\n tbl[a][b]=1\n tbl[b][a]=1 \ndef dfs(s,visited):\n if len(visited)==N:\n return 1\n \n ans=0\n for i in range(1,N+1):\n if i==s: continue \n if tbl[s][i]==1 and (i not i... | ['Runtime Error', 'Accepted'] | ['s014879902', 's711279818'] | [3064.0, 3064.0] | [18.0, 34.0] | [569, 552] |
p03805 | u414920281 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nn,m=map(int,input().split())\npath=[[False]*n for i in range(n)]\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n path[a][b]=True\n path[b][a]=True\nans=0;\n\nfor i in itertools.permutations(range(n),n):\n if i[0]==0:\n for j in range(n):\n if j=... | ['Runtime Error', 'Accepted'] | ['s233435306', 's501515767'] | [3064.0, 3064.0] | [25.0, 24.0] | [426, 423] |
p03805 | u426108351 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def lensetlist(A):\n B = []\n for i in A:\n if i not in B:\n B.append(i)\n return len(B)\n\nN, M = map(int, input().split())\nA = []\nB = []\n\nfor i in range(M):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nfor i in range(M):\n A.append(B[i])\n B.append(A[... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s683140295', 's690029680', 's981123985', 's431271110'] | [3064.0, 8308.0, 3064.0, 9844.0] | [17.0, 2104.0, 17.0, 159.0] | [823, 808, 677, 666] |
p03805 | u431981421 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(i):\n global count\n global seen\n global G\n\n print(seen)\n end = True\n for n in range(N):\n if seen[n] == 0 and n != i:\n end = False\n\n if (end):\n count += 1\n return\n\n seen[i] = 1\n for g in G:\n if g[0] == i:\n if seen[g[1]] == 1:\n continue\n dfs(g[1])\n ... | ['Wrong Answer', 'Accepted'] | ['s710448017', 's106011430'] | [3064.0, 3064.0] | [17.0, 57.0] | [580, 565] |
p03805 | u437351386 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=list(map(int,input().split()))\n\nimport sys\nsys.setrecursionlimit(10**7)\n\n\nes=[[0 for i in range(n)] for j in range(n)]\nfor i in range(m):\n a,b=list(map(int,input().split()))\n es[a-1][b-1]=1\n es[b-1][a-1]=1\n\n \n\n\ndef dfs(v,visited):\n ans=0\n \n \n visited[v-1]=1\n print(visited)\n \n if v... | ['Wrong Answer', 'Accepted'] | ['s421837791', 's970261687'] | [9232.0, 9144.0] | [47.0, 36.0] | [892, 969] |
p03805 | u440129511 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import networkx as nx\nn,m=map(int,input().split())\ns=[list(map(int,input().split())) for _ in range(m)]\ng=nx.Graph()\ng.add_edges_from(s)\n\n\nl=[[] for _ in range(n)]\nfor i in range(m):\n a,b=s[i][0],s[i][1]\n l[a-1].append(b)\n l[b-1].append(a)\n\nl1=sum(l, []) \nl1.insert(0,1)\nl_depth=list(dict.fromk... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s340076308', 's432871510', 's694684093', 's757292871', 's444048832'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 18.0, 28.0] | [728, 736, 734, 736, 856] |
p03805 | u454557108 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['# -*- coding: utf-8 -*-\nimport numpy as np\n\nn,m = map(int, input().split())\ngraph = [[0 for i in range(n)] for j in range(n)]\ngraph = np.array(graph)\n\nfor i in range(m):\n a,b = map(int, input().split())\n graph[a-1].append(b-1)\n graph[b-1].append(a-1)\n\nused = [False]*n\nused[0] = True\n\ndef DFS(v... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s090249858', 's983263602', 's280117527'] | [27148.0, 26984.0, 9212.0] | [111.0, 113.0, 31.0] | [532, 513, 469] |
p03805 | u463858127 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import sys\nsys.setrecursionlimit(10**20)\n\nN, M = map(int, input().split())\n\nMap = [[] for _ in range(M)]\nreached = [False]*N\n\nfor _ in range(M):\n aa, bb = map(int, input().split())\n Map[aa-1].append(bb-1)\n Map[bb-1].append(aa-1)\n\ncnt = 0\n\ndef DFS(x):\n global cnt\n reached[x] = True\n\n ... | ['Runtime Error', 'Accepted'] | ['s126141309', 's689600860'] | [3064.0, 3064.0] | [17.0, 24.0] | [502, 501] |
p03805 | u484315555 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["\nclass Graph():\n def __init__(self):\n \n self.adjacency_dict = {}\n \n def add_vertex(self, v):\n \n self.adjacency_dict[v] = []\n def add_edge(self, v1, v2):\n \n \n self.adjacency_dict[v1].append(v2)\n self.adjacency_dict[v2].append(v1)\n def... | ['Wrong Answer', 'Accepted'] | ['s142246284', 's128452097'] | [4340.0, 3192.0] | [129.0, 38.0] | [2299, 2318] |
p03805 | u492447501 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import copy\ndef dfs(cur_node, pre_node, Node_num, map, l):\n \n\n if Node_num == N-1 or cur_node <= 0 or cur_node >= N-1:\n return\n elif l[pre_node][cur_node]==0: \n return\n elif map[cur_node]==True:\n return\n\n map[cur_node]=True\n\n for i in range(N):\n if i != cur_... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s128626213', 's166825589', 's188742968', 's334603731', 's413207918', 's468061684', 's539978726', 's832400804', 's868576848', 's967351072', 's630338603'] | [3444.0, 3444.0, 3444.0, 3444.0, 3444.0, 3444.0, 3444.0, 3444.0, 3444.0, 3956.0, 3444.0] | [22.0, 22.0, 23.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 39.0, 496.0] | [1031, 1029, 1016, 1112, 1031, 1107, 1053, 1016, 1015, 1033, 469] |
p03805 | u500297289 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["import sys\nsys.setrecursionlimit(1000000)\n\nN, M = map(int, input().split())\nedge = [[] for _ in range(N + 1)]\nab = [list(map(int, input().split())) for _ in range(M)]\nfor i in range(M):\n a, b = ab[i][0], ab[i][1]\n edge[a].append(b)\n edge[b].append(a)\n\n\ndef f(now, v):\n v = v & (1 << now)\n ... | ['Runtime Error', 'Accepted'] | ['s762852481', 's619805117'] | [708980.0, 3064.0] | [1822.0, 34.0] | [451, 473] |
p03805 | u500944229 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m = map(int,input())\npath = [map(int,input()) for x in range(m)]\n\ntable = [[] for x in range(n)]\nfor x in path:\n table[int(x[0])-1].append(int(x[1])-1)\n table[int(x[1])-1].append(int(x[0])-1)\n \nimport itertools\ncount = 0\nfor z in itertools.permutations(range(0,n)):\n if z[0] == 0:\n pri... | ['Runtime Error', 'Accepted'] | ['s885173146', 's353958916'] | [3064.0, 3064.0] | [18.0, 32.0] | [494, 497] |
p03805 | u503901534 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nn,m = map(int,input().split())\nH = [[0 for _ in range(n)] for _ in range(n) ]\n\nfor _ in range(m):\n a, b = map(int,input().split())\n edge_list.append([a-1,b-1])\n H[a-1][b-1] = 1\n H[b-1][a-1] = 1\n \nl = [0 for _ in range(n)]\nans = 0\n\ndef dfs(no... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s028982451', 's368221068', 's391444038', 's463865893', 's773711620', 's870766558'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 17.0, 30.0] | [689, 642, 657, 658, 651, 665] |
p03805 | u513900925 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\nedge_list = [list() for i in range(N)]\nfor i in range(M):\n a,b = map(int,input().split())\n edge_list[a-1].append(b-1)\n edge_list[b-1].append(a-1)\ndone = [0] * n\nchk = 0\ndef dfs(s,done):\n done = done[:]\n global chk\n done[s] = True \n if all(don... | ['Runtime Error', 'Accepted'] | ['s629194471', 's959927766'] | [3064.0, 3064.0] | [18.0, 27.0] | [433, 436] |
p03805 | u516554284 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nn,m=map(int,input().split())\nrin=[[]for _ in range(n)]\nfor _ in range(m):\n a,b=map(int,input().split())\n rin[a-1].append(b-1)\n rin[b-1].append(a-1)\n \nli=[ i for i in range(1,n+1)]\n\nans=0\n\nfor v in itertools.permutations(li):\n pas=0\n ch=0\n st=1\n for x in range(n-1):\n if v... | ['Wrong Answer', 'Accepted'] | ['s361805166', 's590974092'] | [9060.0, 9136.0] | [94.0, 35.0] | [410, 410] |
p03805 | u517910772 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def abc054_c_one_stroke_paths():\n import copy\n N, E = map(int, input().split())\n\n # create graph G\n G = {}\n for n in range(N):\n a, z = map(int, input().split())\n G[a] = G.get(a, [])\n G[a].append(z)\n G[z] = G.get(z, [])\n G[z].append(a)\n\n print(G)\n\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s238694906', 's956208555', 's993156111'] | [3444.0, 3444.0, 3064.0] | [22.0, 22.0, 28.0] | [796, 783, 709] |
p03805 | u524534026 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import sys\nimport itertools\nn,m=map(int,input().split())\nab=[]\nfor _ in range(m):\n ab.append(list(map(int,input().split())))\n\nlis=[i for i in range(1,n+1)]\nper_lis = itertools.permutations(lis) \n\nans=0\nfor one_case in per_lis:\n if one_case[0]==1:\n tmp=0\n for j in range(n-1):\n ... | ['Wrong Answer', 'Accepted'] | ['s259813825', 's543310324'] | [3064.0, 8052.0] | [117.0, 288.0] | [501, 568] |
p03805 | u538381753 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["n, m = [int(x) for x in input().split(' ')]\n\nedges = set([tuple(input().split(' ')) for _ in range(n)])\nedges.update([(x[1], x[0]) for x in list(edges)])\n\n\ndef dfs(node, history):\n ans = 0\n if len(history) == n - 1:\n print(history)\n return 1\n\n nextnodes = [\n x[1] for x in ed... | ['Runtime Error', 'Accepted'] | ['s222734065', 's552353134'] | [3064.0, 3064.0] | [19.0, 61.0] | [520, 502] |
p03805 | u547167033 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nn,m=map(int,input().split())\ng=[[] for i in range(n)]\nfor _ in range(m):\n u,v=map(int,input().split())\n g[u-1].append(v-1)\n g[v-1].append(u-1)\nans=0\nfor v in permutations([int(i) for i in range(n)],n):\n for i in range(n-1):\n if not v[i+1] in g[v[i]]:\n break\n ... | ['Wrong Answer', 'Accepted'] | ['s531609089', 's251927286'] | [3064.0, 3064.0] | [98.0, 33.0] | [334, 361] |
p03805 | u548545174 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import sys\nsys.setrecursionlimit(1000000)\n\nN, M = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(M)]\nfor j in ab:\n if j[::-1] not in ab:\n ab.append(j[::-1])\n\nans = 0\n\n#idx = [_ for _ in ab if _[0] == 1]\n#idx = (ab.index(idx), 0)\n\nsearched = [0] * N\nsearched[0] ... | ['Wrong Answer', 'Accepted'] | ['s107677794', 's824375937'] | [3064.0, 3064.0] | [17.0, 25.0] | [669, 572] |
p03805 | u552738814 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\nedges = {i:[] for i in range(1,M+1)}\nfor i in range(M):\n a,b = map(int,input().split())\n edges[a].append(b)\n edges[b].append(a)\n\n\ndef dfs(list):\n \n if len(list) == N:\n return 1\n else:\n x = list[-1]\n \n \n next = [n for n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s319398602', 's625726331', 's825708443'] | [9096.0, 9148.0, 9204.0] | [27.0, 28.0, 40.0] | [832, 861, 854] |
p03805 | u557282438 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nN,M = map(int,input().split())\nab = [list(map(int,input().split())) for i in range(M)]\nr = list(range(1,N+1))\nok = 1\ncnt = 0\nfor v in itertools.permutations(r):\n if(v[0] == 1):\n ok = 1\n for i in range(N-1):\n if(list(v[i:i+2]) not in ab and list(reversed(v[i:i+2])... | ['Wrong Answer', 'Accepted'] | ['s230891206', 's266087670'] | [3316.0, 3064.0] | [86.0, 74.0] | [439, 419] |
p03805 | u557494880 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\nG = [[] for i in range(N+1)]\nfor i in range(M):\n a,b = map(int,input().split())\n G[a].append(b)\n G[b].append(a)\nl = [i for i in range(2,N+1)]\nimport itertools\nans = 0\nfor v in itertools.permutations(l):\n s = 1\n t = 1\n while v:\n s = t\n t = v.... | ['Runtime Error', 'Accepted'] | ['s265274673', 's993557517'] | [3064.0, 3064.0] | [19.0, 34.0] | [402, 431] |
p03805 | u560988566 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m = map(int, input().split())\nls = [tuple(map(int, input().split())) for _ in range(m)]\nneighborls = []\nfor i in range(1,n+1):\n neighbors = []\n for j in range(1, m+1):\n if (i,j) in ls or (j,i) in ls:\n neighbors.append(j)\n neighborls.append(neighbors)\n\nans = 0\n\ndef main():\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s088753415', 's959764831', 's789688345'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 27.0] | [730, 719, 422] |
p03805 | u575431498 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(i):\n if all(visited):\n global ans\n ans += 1\n return\n for j in range(N):\n if g[i][j] and not visited[j]:\n visited[j] = True\n dfs(j)\n visited[j] = False\n\nN, M = map(int, input().split())\ng = [[False] * N for _ in range(N)]\nfor _ in ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s152319982', 's934617149', 's670626781'] | [3064.0, 3064.0, 3444.0] | [30.0, 30.0, 49.0] | [453, 464, 586] |
p03805 | u576432509 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\na=[]\n\nfor i in range(m):\n ai,bi=map(int,input().split())\n a.append([ai,bi])\n\nni=[0]*n\n \ndef pathm(n,a,bi,pcnt,ni):\n if n==1:\n pcnt=pcnt+1\n print("2:","n:",n,"bi:",bi,"pcnt:",pcnt)\n return pcnt\n else:\n n=n-1\n for mm in range... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s189244013', 's596676646', 's905087904', 's225365305'] | [3064.0, 3188.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0, 27.0] | [878, 919, 920, 517] |
p03805 | u580904613 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nadj_matrix = [[0] * n for _ in range(N)]\n\nfor i in range(m):\n a, b = map(int, input().split())\n adj_matrix[a-1][b-1] = 1\n adj_matrix[b-1][a-1] = 1\n \ndef dfs(v, used):\n if not False in used:\n return 1\n \n ans = 0\n for i in range(n):\n if not adj_matrix[v][i]:\... | ['Runtime Error', 'Accepted'] | ['s425996575', 's388892569'] | [3064.0, 3064.0] | [17.0, 28.0] | [491, 544] |
p03805 | u583826716 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from copy import deepcopy\n\n\n\ndef wfs(tree, root, node_num):\n lost_list = [root]\n\n def _wfs(tree, root, lost_list) -> int:\n if len(lost_list) == node_num:\n print(lost_list)\n return 1\n counter = 0\n for i in tree[root]:\n if i not in lost_list:\n ... | ['Wrong Answer', 'Accepted'] | ['s948008627', 's696960881'] | [3700.0, 3572.0] | [127.0, 180.0] | [725, 694] |
p03805 | u588081069 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from log import logger\n\nN, M = list(map(int, input().split()))\n\nkey_value = {}\nfor i in range(M):\n a, b = input().split()\n try:\n key_value[a].append(b)\n except KeyError:\n key_value[a] = [b]\n try:\n key_value[b].append(a)\n except KeyError:\n key_value[b] = [a]\n\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s498058004', 's580015649', 's023166072'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 25.0] | [1680, 835, 803] |
p03805 | u593019570 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["n,m = map(int, input().split())\nlink = [[] for i in range(n)]\nfor _ in range(m):\n a,b = map(int, input().split())\n link[a-1].append(b-1)\n link[b-1].append(a-1)\n\nused = [0 for i in range(n)]\nans = 0\nprint(link)\ndef dfs(now, prev):\n global ans\n\n if sum(used) == n:\n #print('+1')\n ... | ['Wrong Answer', 'Accepted'] | ['s422592365', 's488118908'] | [3064.0, 9388.0] | [30.0, 40.0] | [585, 487] |
p03805 | u603234915 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\ndef dfs(v, visited):\n global adjacency_list, ans\n # copy\n visited_copy = visited[:]\n print("v;%d" % v)\n print(visited)\n \n visited_copy[v] = True\n for a in adjacency_list[v]:\n \n if sum(visited_copy) == N:\n ans += 1\n continue\n \n i... | ['Wrong Answer', 'Accepted'] | ['s537937038', 's581516964'] | [3828.0, 3064.0] | [83.0, 34.0] | [1130, 1031] |
p03805 | u607563136 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(g,v,depth):\n if seen[v]==True:return 0\n if depth==n:return 1\n seen[v] = True\n paths = 0\n for next_v in g[v]:\n paths += dfs(g,next_v,depth+1)\n seen[v] = False\n return paths\n \nn,m = map(int,input().split())\n\ng = [[]*(n+1) for _ in range(n+1)]\n\nfor _ in range(m):\... | ['Wrong Answer', 'Accepted'] | ['s988534636', 's181850759'] | [9104.0, 9108.0] | [33.0, 36.0] | [414, 421] |
p03805 | u617515020 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nn,m = map(int,input().split())\ne = [tuple(sorted(map(int,input().split()))) for _ in range(m)]\n\nans = 1\nfor i in permutations(range(2, n+1), n-1):\n l = [1] + list(i)\n ans += sum(1 for j in zip(l, l[1:]) if tuple(sorted(j)) in e) == n-1\n\nprint(ans)', 'from itertools import... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s105957432', 's889909944', 's536582098'] | [3064.0, 3064.0, 3188.0] | [56.0, 44.0, 56.0] | [284, 284, 284] |
p03805 | u626468554 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nn,m = map(int,input().split())\nli = [[0 for _ in range(n)] for _ in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n a-=1\n b-=1\n li[a][b] = 1\n li[b][a] = 1\n\nnum = [i for i in range(1,n)]\nans = 0\n\nfor v in itertools.permutations(num):\n print(v)\n if ... | ['Wrong Answer', 'Accepted'] | ['s201907162', 's767154142'] | [3188.0, 3064.0] | [40.0, 27.0] | [482, 516] |
p03805 | u633548583 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nn,m=map(int,input().split())\np=[[False]*n for i in range(n)]\n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n p[a][b]=True\n p[b][a]=True\nans=0\nfor i in itertools.permutations(range(1,n),n-1):\n list=[0]+[i]\n if all(p[list[j]][list[j+1]]==True for j in ra... | ['Runtime Error', 'Accepted'] | ['s999598357', 's227098646'] | [3064.0, 3064.0] | [18.0, 31.0] | [342, 356] |
p03805 | u634208461 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nN, M = map(int, input().split())\nedge = []\nfor _ in range(M):\n a, b = map(int, input().split())\n edge.append(set((a, b)))\n\np = list(map(lambda x: [1] + list(x), permutations([i for i in range(2, N + 1)])))\n\nans = 0\n\nfor root in p:\n for i in range(len(root) - 1):... | ['Wrong Answer', 'Accepted'] | ['s047073691', 's087258840'] | [3956.0, 3700.0] | [65.0, 53.0] | [436, 416] |
p03805 | u643840641 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['m, n = map(int, input().split())\nedge = [[False for j in range(n)] for i in range(n)]\nfor _ in range(m):\n\ta, b = map(int, input().split())\n\tedge[a-1][b-1] = edge[b-1][a-1] = True\nvisited = [False for _ in range(n)]\nans = 0\ndef dfs(v):\n\tvisited[v] = True\n\tif all(x==True for x in visited):\n\t\tglobal ans\... | ['Runtime Error', 'Accepted'] | ['s277342779', 's931298649'] | [3064.0, 3064.0] | [18.0, 40.0] | [449, 439] |
p03805 | u653005308 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\npath=[[[0]*(n+1)]*(n+1)]\nfor i in range(m):\n a,b=map(int,input().split())\n path[a][b]=1\n path[b][a]=1\nvisited=[[0]*(n+1)]\nvisited[1]=1\ndef dfs(position,visited,n):\n all_visited=1\n for i in range(1,n+1):\n if visited[i]==0:\n all_visited=0\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s055026138', 's139028504', 's474777228', 's898944786', 's979948128'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 20.0, 18.0, 17.0, 37.0] | [1033, 691, 1013, 1039, 1042] |
p03805 | u655834330 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def read_input():\n n, m = map(int, input().split())\n\n edges = []\n nodes = list(range(1, n + 1))\n\n for i in range(m):\n a, b = map(int, input().split())\n edges.append((a, b))\n\n\n edges_dic = {}\n for i in range(n):\n edges_dic[i + 1] = []\n\n for edge in edges:\n ... | ['Wrong Answer', 'Accepted'] | ['s174428824', 's227425115'] | [3064.0, 3064.0] | [19.0, 33.0] | [1408, 1471] |
p03805 | u658987783 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nn,m=map(int,input().split())\ns=[set(map(int,input().split())) for _ in range(n)]\n\nans=0\nx=[i for i in range(2,n+1)]\nprint(x)\ncand=itertools.permutations(x)\nprint(cand)\nfor i in cand:\n crnt=1\n for nxt in i:\n if set([crnt,nxt]) in s:\n crnt=nxt\n else:\n break\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s970519990', 's642570412'] | [3064.0, 3064.0] | [24.0, 49.0] | [320, 307] |
p03805 | u659100741 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["cnt = 0\n\ndef dfs(v, n, used, linked_list):\n global cnt\n if len(used) == n:\n cnt += 1\n return\n else:\n for next_v in linked_list[v]:\n if next_v not in used:\n used.append(next_v)\n dfs(next_v, n, used, linked_list)\n #used.re... | ['Wrong Answer', 'Accepted'] | ['s808037694', 's707288227'] | [3064.0, 3064.0] | [17.0, 28.0] | [679, 678] |
p03805 | u677393869 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\nN, M = map(int, input().split())\n\npath_matrix = []\n\n\nfor n in range(N):\n path_matrix.append([False] * N)\n\n\nfor m in range(M):\n line = map(int, input().split())\n paths = [x - 1 for x in line]\n path_matrix[paths[0]][paths[1]] = True\n path_matrix[paths[1]][paths[0]] = True\n\n\nvisited = [F... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s200852142', 's832736125', 's071378183'] | [9224.0, 9232.0, 9152.0] | [28.0, 29.0, 32.0] | [874, 873, 899] |
p03805 | u679390859 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input(),aplit())\n\npath = [[] for i in range(N)]\n\nfor _ in range(M):\n\ta,b = map(int,input(),split())\n\tpath[a-1],append(b-1)\n path[b-1],append(a-1)\nvis = [0 for i in range(N)]\ncnt = 0\n\ndef dfs(now,path):\n\tglobal cnt\n \tif depth == N: cnt+=1\n\tfor new in path[now]:\n \tif vis[new] =... | ['Runtime Error', 'Accepted'] | ['s614124162', 's241557309'] | [8960.0, 9012.0] | [23.0, 35.0] | [399, 379] |
p03805 | u686036872 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = map(int, input().split())\n\nG = [[] for i in range(N)]\nfor i in range(M):\n a, b = map(int, input().split())\n G[a-1].append(b-1)\n G[b-1].append(a-1)\n\nvisited = [0]*N\nans = 0\nvisited[0] = 1\n\ndef dfs(v):\n global ans\n if 0 not in visited:\n return 1\n\n for i in G[v]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s044797375', 's053828886', 's105446178', 's136348096', 's344550966', 's372578830', 's593870205', 's614458282', 's625768011', 's678594627', 's712040623', 's882696199', 's966033419', 's969271336', 's987326694', 's184342375'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3192.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [28.0, 34.0, 17.0, 17.0, 17.0, 32.0, 17.0, 17.0, 18.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 24.0] | [431, 431, 436, 425, 437, 427, 458, 436, 438, 463, 445, 448, 430, 435, 448, 447] |
p03805 | u686390526 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int, input().split())\nm=[]\nfor i in range(M):\n m.append(list(map(int, input().split())))\n\n\nimport copy\ndef check(c):\n if len(c) != N-1:\n return False\n\n for k in range(2**len(c)):\n f=False\n cc=copy.deepcopy(c)\n for l in range(len(c)):\n if k>>l&1==1:\n tmp=cc[l][0]\n ... | ['Wrong Answer', 'Accepted'] | ['s582882903', 's331793834'] | [3444.0, 3064.0] | [2104.0, 29.0] | [1102, 497] |
p03805 | u693391925 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\nimport queue\nimport copy\nimport sys\nfrom astropy.io.fits.convenience import append\nsys.setrecursionlimit(50000000) \ninput=sys.stdin.readline\n\n\nN, M = map(int, input().split())\nl = []\n\nfor i in range(M):\n l.append(list(map(lambda x: int(x)-1 , input().split())))\n\nlis = [[] for i in range(N)]\n\nfor ... | ['Runtime Error', 'Accepted'] | ['s495246799', 's902106979'] | [4080.0, 3444.0] | [27.0, 165.0] | [907, 821] |
p03805 | u694810977 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nq = []\nfor i in range(m):\n a, b = map(int, input().split())\n q.append({a, b})\ncnt = 0\nwhile cnt != 10000:\n a = q.pop()\n for j in q:\n if len(j & a) != 0: \n j |= a\n count = 0\n break\n else: \n q = [a] + ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s923578659', 's962886127', 's446646001'] | [3064.0, 3064.0, 3064.0] | [17.0, 21.0, 34.0] | [530, 1200, 1407] |
p03805 | u724687935 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def main():\n import sys\n from itertools import permutations\n \n readlines = sys.stdin.buffer.readlines\n N, M = map(int, input().split())\n edge = [[0] * N for _ in range(N)]\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n edge[a][b] = 1\n ed... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s506602877', 's562880179', 's699476409'] | [3064.0, 3064.0, 3064.0] | [22.0, 17.0, 25.0] | [675, 483, 668] |
p03805 | u729119068 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nN,M=map(int,input().split())\nedges={tuplec(sorted(map(int,input().split()))) for i in range(M)}\nans=0\nfor i in itertools.permutations(range(2,N+1),N-1):\n l=[1]+list(i)\n ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1\nprint(ans)', 'import itertools\nN,M=map(int,i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s267953821', 's633933338', 's574521608'] | [8952.0, 8920.0, 9120.0] | [27.0, 26.0, 47.0] | [276, 272, 271] |
p03805 | u732870425 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\n\nN, M = map(int, input().split())\nedge = [[0] * (N+1) for _ in range(N+1)]\nfor i in range(M):\n a, b = map(int, input().split())\n edge[a][b] = 1\n edge[b][a] = 1\n\nans = 0\nnode = list(range(1, N+1))\nfor x in itertools.permutations(node):\n for i in range(N-1):\n if not ed... | ['Wrong Answer', 'Accepted'] | ['s239725702', 's788880782'] | [3064.0, 3064.0] | [90.0, 30.0] | [417, 416] |
p03805 | u739959951 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nn,m=(map(int,input().split()))\nl=[]\n\nfor _ in range(m):\n a,b=(map(int,input().split()))\n l.append([a,b])\n\nans=0\nans_list=[0]*n\n\nfor i in range(n):\n l_new=l[0:i]+l[i+1:n]\n l_new=itertools.chain.from_iterable(l_new)\n for i in l_new:\n ans_list[int(i)-1]+=1\n print(ans_list)\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s476708656', 's702459728', 's530195910'] | [3064.0, 3064.0, 3064.0] | [18.0, 24.0, 25.0] | [420, 568, 559] |
p03805 | u747703115 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nfrom math import factorial as fa\nP = itertools.permutations(list(range(n)))\nn, m = map(int, input().split())\nG = [set() for _ in range(n)]\nfor _ in range(m):\n a,b = map(lambda x:int(x)-1, input().split())\n G[a].add(b)\n G[b].add(a)\n\nans = 0\nfor _ in range(fa(n)):\n p = next(P)\n... | ['Runtime Error', 'Accepted'] | ['s774541324', 's260128708'] | [8920.0, 9360.0] | [25.0, 33.0] | [490, 385] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.