s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s173126175 | p03805 | u902468164 | 1556214531 | Python | Python (3.4.3) | py | Runtime Error | 36 | 3064 | 724 | def dfs(v, N, visited, graph):
all_visited = True
for i in range(N):
if visited[i] is False :
all_visited = False
if all_visited:
return 1
ret = 0
for i in range(N):
if graph[v][i] is False:
continue
if visited[i]:
continue
... |
s898659779 | p03805 | u573970531 | 1556207137 | Python | Python (3.4.3) | py | Runtime Error | 48 | 3064 | 403 | import itertools
n,m=list(map(int,input().split()))
path=[[False]*m for _ in range(m)]
for i in range(m):
a,b=list(map(int,input().split()))
path[a-1][b-1]=True
ans=0
for i in itertools.permutations(list(range(n))):
if i[0]!=0:
continue
flg=True
for j in range(len(i)-1):
if path[min(i[j],i[j+1])][ma... |
s487868978 | p03805 | u186838327 | 1555232343 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3064 | 409 | n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
a, b = map(int, input().split())
l[a-1].append(b-1)
l[b-1].append(a-1)
import itertools
ans = 0
for p in itertools.permutations(range(n)):
if p[0] == 0:
flag = True
for i in range(n-1):
if not p[i+1] i... |
s917491591 | p03805 | u186838327 | 1555232255 | Python | Python (3.4.3) | py | Runtime Error | 94 | 3064 | 434 | n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
a, b = map(int, input().split())
l[a-1].append(b-1)
l[b-1].append(a-1)
import itertools
ans = 0
for p in itertools.permutations(range(n)):
if p[0] == 0:
flag = 1
else:
flag = 0
for i in range(n-1):
... |
s582448031 | p03805 | u186838327 | 1555232108 | Python | Python (3.4.3) | py | Runtime Error | 32 | 3064 | 406 | n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
a, b = map(int, input().split())
l[a-1].append(b-1)
l[b-1].append(a-1)
import itertools
ans = 0
for p in itertools.permutations(range(n)):
if p[0] == 0:
flag = 1
for i in range(n-1):
if not p[i+1] in l... |
s046744504 | p03805 | u186838327 | 1555231988 | Python | Python (3.4.3) | py | Runtime Error | 37 | 3188 | 433 | n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
a, b = map(int, input().split())
l[a-1].append(b-1)
l[b-1].append(a-1)
import itertools
ans = 0
for p in itertools.permutations(range(n)):
if p[0] == 0:
flag = 1
for i in range(n-1):
if p[i+1] in l[p[i... |
s479640175 | p03805 | u603745966 | 1555127199 | Python | Python (3.4.3) | py | Runtime Error | 37 | 4324 | 1710 | from functools import reduce
import math
import itertools
def main():
# N! を求める
# f = math.factorial(N)
# 切り捨て
# 4 // 3
# 切り上げ
#-(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2... |
s896649735 | p03805 | u328207927 | 1555002683 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3064 | 631 | import sys
sys.setrecursionlimit(100000)
ans=0
def dfs(v,n,visi):
allv=True
for i in visi:
if not i:
allv=False
if allv:
return 1
ret=0
for i in range(n):
if G[v][i]==False:
continue
if visi[i]:
continue
visi[i]=True
... |
s199091251 | p03805 | u594567187 | 1554877622 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 600 | from collections import defaultdict
vertices, edges = map(int, input().split(" "))
connect = defaultdict(set)
for i in range(vertices):
a, b = map(int, input().split(" "))
connect[a] |= {b}
connect[b] |= {a}
answer = 0
queue = [[set(), 1]]
while queue:
visited, now = queue.pop()
visited |= {now}
... |
s152467545 | p03805 | u594567187 | 1554705597 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3316 | 1238 | from collections import defaultdict
vertices, edges = map(int, input().split(" "))
connect = defaultdict(set)
for i in range(vertices):
a, b = map(int, input().split(" "))
connect[a] |= {b}
connect[b] |= {a}
comb_answers = defaultdict(int)
def bfs(start, connect, visited):
queue = [start]
while qu... |
s809728280 | p03805 | u151625340 | 1554644765 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 577 | N,M = map(int,input().split())
dict = {}
for m in range(M):
a,b = map(int,input().split())
if a in dict:
dict[a].append(b)
else:
dict[a] = [b]
if b in dict:
dict[b].append(a)
else:
dict[b] = [a]
ans = 0
l = [0 for i in range(N+1)]
l[1] = 1
def dfs(now):
global l
... |
s039517482 | p03805 | u285443936 | 1554519402 | Python | Python (3.4.3) | py | Runtime Error | 86 | 3064 | 526 | N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]
visited = {i:False for i in range(M)}
visited[0] = True
ans = 0
def DFS(x):
global ans
nextx = []
if False not in visited.values():
ans += 1
return
for i in range(M):
if x in ab[i]:
xcol = ab[i].index(x)... |
s286696330 | p03805 | u466331465 | 1554506499 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3316 | 502 | from collections import deque
def dfs(v,N,memo):
ans =0
if not False in memo.values():
return 1
for u in E[v]:
if memo[u]!=True:
memo[u] = True
ans += dfs(u,N,memo)
memo[u] = False
return ans
N,M = list(map(int,input().split()))
memo = {i:False for i i... |
s266019728 | p03805 | u594567187 | 1554445937 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3316 | 514 | from collections import defaultdict
vertices, edges = map(int, input().split(" "))
connect = defaultdict(set)
for i in range(vertices):
a, b = map(int, input().split(" "))
connect[a] |= {b}
connect[b] |= {a}
answer = 0
queue = [[set(), 1]]
while queue:
visited, now = queue.pop()
visited |= {now}
... |
s629194471 | p03805 | u513900925 | 1554410644 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 433 | N,M = map(int,input().split())
edge_list = [list() for i in range(N)]
for i in range(M):
a,b = map(int,input().split())
edge_list[a-1].append(b-1)
edge_list[b-1].append(a-1)
done = [0] * n
chk = 0
def dfs(s,done):
done = done[:]
global chk
done[s] = True
if all(done):
ch... |
s136257552 | p03805 | u013408661 | 1554400426 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 416 | import sys
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
visit=[0]*(n+1)
visit[1]=1
node=[[] for i in range(n+1)]
for i in number:
node[i[0]].append(i[1])
node[i[1]].appedn(i[0])
ans=0
def dfs(x):
global ans
if visit.count(1)==n:
ans+=1
return 0
for i in node[x]:... |
s693316443 | p03805 | u013408661 | 1554400322 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 405 | import sys
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
visit=[0]*(n+1)
node=[[] for i in range(n+1)]
for i in number:
node[i[0]].append(i[1])
node[i[1]].appedn(i[0])
ans=0
def dfs(x):
global ans
if visit.count(1)==n:
ans+=1
return 0
for i in node[x]:
if vis... |
s593578534 | p03805 | u013408661 | 1554400281 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 406 | import sys
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
visit=[0]*(n+1)
node=[[] for i in range(n+1)]
for i in number:
node[i[0]].append(i[1])
node[i[1]].appedn(i[0])
ans=0
def dfs(x):
global ans
if visit.count(1)==n:
ans+=1
return 0
for i in visit[x]:
if vi... |
s984920442 | p03805 | u013408661 | 1554392373 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3192 | 1197 | import sys
sys.setrecursionlimit(20)
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
startwithone=[i for i in number if i[0]==1]
notstartwithone=[i for i in number if i[0]!=1]
if len(startwithone)==0:
print(0)
exit()
if len(startwithone)==0:
if n==2:
print(1)
exit()
... |
s058079099 | p03805 | u013408661 | 1554392223 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3188 | 1072 | import sys
sys.setrecursionlimit(20)
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
startwithone=[i for i in number if i[0]==1]
notstartwithone=[i for i in number if i[0]!=1]
ans=0
flag2=0
def find(x):
if root[x]==x:
return x
return find(root[x])
def check(x,y):
return fi... |
s199904692 | p03805 | u013408661 | 1554352440 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 743 | import sys
n,m=map(int,input().split())
number=[[int(i) for i in l.split()] for l in sys.stdin]
ans=0
root=[i for i in range(n)]
rank=[0]*(n+1)
def find(x):
if root[x]==x:
return x
root[x]=find(root[x])
return root[x]
def check(x,y):
return find(x)==find(y)
def union(x,y):
x=find(x)
y=find(y)
if rank[... |
s580015649 | p03805 | u588081069 | 1554230754 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 835 | from log import logger
N, M = map(int, input().split())
key_value = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
key_value[a].append(b)
key_value[b].append(a)
logger.info('key_value: {}\n'.format(key_value))
closed_list = [False] * N
closed_list[0] = Tr... |
s498058004 | p03805 | u588081069 | 1554226465 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1680 | from log import logger
N, M = list(map(int, input().split()))
key_value = {}
for i in range(M):
a, b = input().split()
try:
key_value[a].append(b)
except KeyError:
key_value[a] = [b]
try:
key_value[b].append(a)
except KeyError:
key_value[b] = [a]
logger.info("key_v... |
s052880314 | p03805 | u620945921 | 1554137203 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 654 | n,m=(int(i) for i in input().split())
mtrx=[[int(i) for i in input().split()] for j in range(m)]
mtrx=[[mtrx[j][0]-1,mtrx[j][1]-1] for j in range(m)]
adjacent=[[] for i in range(n)]
#print(adjacent)
for i in range(n):
adjacent[mtrx[i][0]]+=[mtrx[i][1]]
adjacent[mtrx[i][1]]+=[mtrx[i][0]]
#print(adjacent)
cnt=[... |
s892547326 | p03805 | u203377003 | 1554086609 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 783 | n, m = map(int, input().split())
D = [list() for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
D[a-1].append(b-1)
D[b-1].append(a-1)
d = [0]*n
d[0] = 1
cnt = 0
def dfs(x):
global cnt
if all(d):
cnt += 1
return
for i in D[x]:
if d[i] == 0:
... |
s968971737 | p03805 | u620945921 | 1554086383 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 696 | n,m=(int(i) for i in input().split())
#print(n,m)
mtrx=[[int(i)-1 for i in input().split()] for j in range(m)]
#print(mtrx)
adjacent=[[i] for i in range(n)]
#print(adjacent)
for i in range(n):
adjacent[mtrx[i][0]]+=[mtrx[i][1]]
adjacent[mtrx[i][1]]+=[mtrx[i][0]]
#print(adjacent)
cnt=[]
def dfs(goal,path):
... |
s505063471 | p03805 | u203377003 | 1554086342 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 793 | n, m = map(int, input().split())
D = [list() for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
D[a-1].append(b-1)
D[b-1].append(a-1)
d = [0]*n
d[0] = 1
cnt = 0
def dfs(x):
global cnt
if all(d):
cnt += 1
return
for i in D[x]:
if d[i] == 0:
... |
s479087196 | p03805 | u203377003 | 1554086174 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 784 | n, m = map(int, input().split())
D = [list() for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
D[a-1].append(b-1)
D[b-1].append(a-1)
d = [0]*n
d[0] = 1
cnt = 0
def dfs(x):
global cnt
if all(d):
cnt += 1
return
for i in D[x]:
if d[i] == 0:
... |
s475638130 | p03805 | u620945921 | 1554085856 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 670 | n,m=(int(i) for i in input().split())
#print(n,m)
mtrx=[[int(i)-1 for i in input().split()] for j in range(m)]
#print(mtrx)
adjacent=[[i] for i in range(n)]
#print(adjacent)
for i in range(n):
adjacent[mtrx[i][0]]+=[mtrx[i][1]]
adjacent[mtrx[i][1]]+=[mtrx[i][0]]
#print(adjacent)
cnt=[]
def dfs(goal,path):
... |
s063348131 | p03805 | u620945921 | 1554085476 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 664 | n,m=(int(i) for i in input().split())
#print(n,m)
mtrx=[[int(i)-1 for i in input().split()] for j in range(m)]
#print(mtrx)
adjacent=[[] for i in range(n)]
#print(adjacent)
for i in range(n):
adjacent[mtrx[i][0]]+=[mtrx[i][1]]
adjacent[mtrx[i][1]]+=[mtrx[i][0]]
#print(adjacent)
cnt=[]
def dfs(goal,path):
... |
s038476640 | p03805 | u620945921 | 1554084157 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 664 | n,m=(int(i) for i in input().split())
#print(n,m)
mtrx=[[int(i)-1 for i in input().split()] for j in range(m)]
#print(mtrx)
adjacent=[[i] for i in range(n)]
#print(adjacent)
for i in range(n):
adjacent[mtrx[i][0]]+=[mtrx[i][1]]
adjacent[mtrx[i][1]]+=[mtrx[i][0]]
#print(adjacent)
cnt=[]
def dfs(goal,path):
... |
s254223110 | p03805 | u538381753 | 1554067419 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 497 | n, m = [int(x) for x in input().split(' ')]
edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])
def dfs(node, history):
ans = 0
if len(history) == n - 1:
return 1
nextnodes = [
x[1] for x in edges if x[1] not in history and x[0] ==... |
s222734065 | p03805 | u538381753 | 1554067368 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 520 | n, m = [int(x) for x in input().split(' ')]
edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])
def dfs(node, history):
ans = 0
if len(history) == n - 1:
print(history)
return 1
nextnodes = [
x[1] for x in edges if x[1] not... |
s224982912 | p03805 | u538381753 | 1554063730 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 462 | n, m = [int(x) for x in input().split(' ')]
edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])
def dfs(node, history):
ans = 0
if len(history) == n:
return 1
nextnodes = [
x[1] for x in edges if x[1] not in history and x[0] == nod... |
s485698971 | p03805 | u228759454 | 1553973133 | Python | Python (3.4.3) | py | Runtime Error | 302 | 12484 | 703 | import numpy as np
N, M = map(int, input().split())
G = np.zeros((N, M))
total_path_num = 0
not_reach_node = list(range(1, N))
node = 0
for i in range(M):
a, b = map(int, input().split())
G[a-1, b-1] += 1
G[b-1, a-1] += 1
def search_path(G, not_reach_node, node):
global total_path_num
if len(not_reach... |
s809803999 | p03805 | u228759454 | 1553972860 | Python | Python (3.4.3) | py | Runtime Error | 296 | 12500 | 661 | import numpy as np
N, M = map(int, input().split())
G = np.zeros((N, M))
total_path_num = 0
not_reach_node = list(range(1, N))
node = 0
for i in range(M):
a, b = map(int, input().split())
G[a-1, b-1] += 1
G[b-1, a-1] += 1
def search_path(G, not_reach_node, node):
global total_path_num
if len(not_reach_n... |
s824965761 | p03805 | u707498674 | 1553909400 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 362 | import itertools
N, M = map(int, input().split())
E = [[] for i in range(N)]
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
E[a].append(b)
E[b].append(a)
count = 0
for V in itertools.permutations(range(1, N)):
if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1))... |
s225882538 | p03805 | u707498674 | 1553909227 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 377 | import itertools
N, M = map(int, input().split())
E = [[N] * (N + 1) for i in range(N + 1)]
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
E[a].append(b)
E[b].append(a)
count = 0
for V in itertools.permutations(range(1, N)):
if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in... |
s565916562 | p03805 | u707498674 | 1553909127 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 407 | import itertools
N, M = map(int, input().split())
E = [[-1] * N for i in range(N)]
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
E[a].append(b)
E[b].append(a)
count = 0
#V = (1,2,3,4,5,6), (1,2,3,4,6,5) ...
for V in itertools.permutations(range(1, N)):
if V[0] in E[0] and ... |
s337822199 | p03805 | u707498674 | 1553908606 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 367 | import itertools
N, M = map(int, input().split())
E = [[0] * N for i in range(N)]
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
E[a].append(b)
E[b].append(a)
count = 0
for V in itertools.permutations(range(1, N)):
if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, ... |
s552649841 | p03805 | u334712262 | 1553455424 | Python | Python (3.4.3) | py | Runtime Error | 42 | 5692 | 1496 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... |
s998302904 | p03805 | u620945921 | 1552685509 | Python | Python (3.4.3) | py | Runtime Error | 2211 | 1708588 | 559 | import itertools
n,m=(int(i) for i in input().split())
#print(n,m)
alist=[]
for i in range(m):
a,b=(int(i) for i in input().split())
alist.append(10*a+b)
alist.append(10*b+a)
#print(alist)
ans=0
mylist=list(itertools.permutations(range(2,m+1)))
#print(mylist)
for j in range(len(mylist)):
mylist1=[10+mylist[j]... |
s969721152 | p03805 | u533885955 | 1552661840 | Python | Python (3.4.3) | py | Runtime Error | 102 | 3936 | 545 | #C問題
N,M = map(int,input().split())
ab=[list(map(int,input().split())) for i in range(M)]
reach=[-1]*(N)
reach[0]=0
ans=0
def cdfs(n):
global ans
global reach
if sum(reach)==0:
ans+=1
reach=[-1]*(N)
reach[0]=0
return
else:
for j in range(N):
if reach[j... |
s028911225 | p03805 | u411858517 | 1552174076 | Python | Python (3.4.3) | py | Runtime Error | 121 | 8052 | 820 | N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
V = [i+1 for i in range(N)]
import itertools
ptr = list(itertools.permutations(V, N))
res = 0
for p in ptr:
if p[0] == 1:
now = 1
flag = [0 for _ in range(N)]
flag[0] = 1
for i in range... |
s806969687 | p03805 | u497596438 | 1552088674 | Python | PyPy3 (2.4.0) | py | Runtime Error | 203 | 41968 | 470 | import itertools
N,M=map(int,input().split())
ab=[]
for i in range(N):
a,b=map(int,input().split())
ab.append([a,b])
per=[i for i in range(2,N+1)]
permu=[]
for i in itertools.permutations(per):
lst=[1]
lst.extend(i)
permu.append(lst)
num=0
for lst in permu:
can=True
for i in range(N-1):
... |
s872444771 | p03805 | u367130284 | 1551260761 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3064 | 674 | n,m=map(int,input().split())
AdjacencyMatrix=[[0]*n for i in [0]*m]
for i in [0]*m:
a,b=map(int,input().split())
AdjacencyMatrix[a-1][b-1]=1
AdjacencyMatrix[b-1][a-1]=1
#print(AdjacencyMatrix)
def DFS(point,TFlist):
# print(TFlist)
if not False in TFlist:
return 1
ans=0
for i in range(n):
if not A... |
s891179193 | p03805 | u136090046 | 1550453286 | Python | Python (3.4.3) | py | Runtime Error | 128 | 3064 | 699 | n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for y in range(m)]
modify = [[] for x in range(m + 1)]
for value1, value2 in array:
modify[value1].append(value2)
modify[value2].append(value1)
def solver(start, array, visited, cnt):
if visited[start]:
return cnt
els... |
s894542083 | p03805 | u945418216 | 1550364045 | Python | Python (3.4.3) | py | Runtime Error | 36 | 3064 | 688 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
for i in range(M):
a_, b_ = map(int,input().split())
# 配列の添字としたいので-1
a[i] = a_ -1
b[i] = b_ -1
route = [0]*N # 通過済
connect=[[0]*M for _ in range(M)]
def dfs(now, depth):
# print("#"*depth,now, depth)
# 通過済ならNG
if route[now]: return 0
#... |
s374028682 | p03805 | u983918956 | 1548549569 | Python | Python (3.4.3) | py | Runtime Error | 32 | 3064 | 540 | import sys
sys.setrecursionlimit(10**9)
N,M = map(int,input().split())
note = [[0]*M for i in range(N)]
visited = [False]*N
visited[0] = True
ans = 0
for i in range(M):
a,b = map(int,input().split())
a -= 1
b -= 1
note[a][b] = 1
note[b][a] = 1
def dfs(p=0, depth=0):
if depth == N-1:
glo... |
s966791527 | p03805 | u983918956 | 1548548823 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 483 | import sys
sys.setrecursionlimit(10**9)
N,M = map(int,input().split())
note = [[0]*M for i in range(N)]
visited = [False]*N
ans = 0
for i in range(M):
a,b = map(int,input().split())
a -= 1
b -= 1
note[a][b] = 1
note[b][a] = 1
def dfs(p=0, depth=0):
if depth == N-2:
global ans
an... |
s715455324 | p03805 | u983918956 | 1548548162 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 620 | N,M = map(int,input().split())
note = [[0]*M for i in range(N)]
visited = [False]*N
ans = 0
for i in range(M):
a,b = map(int,input().split())
a -= 1
b -= 1
note[a][b] = 1
note[b][a] = 1
def dfs(p = 0):
True_count = 0
False_count = 0
for f in visited:
if f is True:
Tr... |
s445268066 | p03805 | u575431498 | 1547175762 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3064 | 464 | def dfs(i):
if all(visited):
global ans
ans += 1
return
for j in range(N):
if g[i][j] and not visited[j]:
visited[j] = True
dfs(j)
visited[j] = False
N, M = map(int, input().split())
g = [[False] * M for _ in range(M)]
for _ in range(M):
a... |
s934617149 | p03805 | u575431498 | 1547175656 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3064 | 464 | def dfs(i):
if all(visited):
global ans
ans += 1
return
for j in range(N):
if g[i][j] and not visited[j]:
visited[j] = True
dfs(j)
visited[j] = False
return
N, M = map(int, input().split())
g = [[False] * M for _ in range(M)]
for _ in rang... |
s224936079 | p03805 | u879870653 | 1546786104 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 529 | from itertools import permutations
N,M = map(int,input().split())
Matrix = [[False for i in range(N)] for j in range(N)]
for i in range(N) :
a,b = map(int,input().split())
a -= 1
b -= 1
Matrix[a][b] = True
Matrix[b][a] = True
Matrix[i][i] = True
arange = list(range(2,N+1))
ans = 0
for pm in... |
s519786213 | p03805 | u879870653 | 1546748794 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 541 | from itertools import permutations
N,M = map(int,input().split())
Matrix = [[False for i in range(N)] for j in range(N)] #隣接行列
for i in range(N) :
Matrix[i][i] = True
for i in range(N) :
row,column = map(int,input().split())
Matrix[row-1][column-1] = True
Matrix[column-1][row-1] = True
arange =... |
s476909995 | p03805 | u879870653 | 1546748599 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 553 | from itertools import permutations as pm
N,M = map(int,input().split())
Matrix = [[False for i in range(N)] for j in range(N)] #隣接行列
for i in range(N) :
Matrix[i][i] = True
for i in range(N) :
row,column = map(int,input().split())
Matrix[row-1][column-1] = True
Matrix[column-1][row-1] = True
ar... |
s550194450 | p03805 | u879870653 | 1546748537 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 547 | from itertools import permutations
N,M = map(int,input().split())
Matrix = [[False for i in range(N)] for j in range(N)] #隣接行列
for i in range(N) :
Matrix[i][i] = True
for i in range(N) :
row,column = map(int,input().split())
Matrix[row-1][column-1] = True
Matrix[column-1][row-1] = True
arange =... |
s657882668 | p03805 | u879870653 | 1546748487 | Python | Python (3.4.3) | py | Runtime Error | 27 | 3064 | 549 | from itertools import permutations
N,M = map(int,input().split())
Matrix = [[False for i in range(N)] for j in range(N)] #隣接行列
#for i in range(N) :
# Matrix[i][i] = True
for i in range(N) :
row,column = map(int,input().split())
Matrix[row-1][column-1] = True
Matrix[column-1][row-1] = True
arange... |
s262100035 | p03805 | u903596281 | 1546463558 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3572 | 395 | import itertools
N,M=map(int,input().split())
edge=[]
for i in range(N+1):
edge.append([0]*(N+1))
for j in range(N):
a,b=map(int,input().split())
edge[a][b]=1
edge[b][a]=1
roots=list(itertools.permutations(range(2,N+1)))
ans=0
for root in roots:
pos=1
for i in range(N-1):
nxt=root[i]
if edge[pos][nx... |
s196121704 | p03805 | u669696235 | 1545880306 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2696 | 825 | import queue
import copy
s=list()
N,M=map(int,raw_input().split())
n=[[0 for i in range(N)] for j in range(N)]
for i in range(M):
a,b=map(int,raw_input().split())
n[a-1][b-1]=1
n[b-1][a-1]=1
arrived=[0 for i in range(N)]
arrived[0]=1
def solve(s,arrived):
narrived=copy.deepcopy(arrived... |
s277342779 | p03805 | u643840641 | 1545545423 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 449 | m, n = map(int, input().split())
edge = [[False for j in range(n)] for i in range(n)]
for _ in range(m):
a, b = map(int, input().split())
edge[a-1][b-1] = edge[b-1][a-1] = True
visited = [False for _ in range(n)]
ans = 0
def dfs(v):
visited[v] = True
if all(x==True for x in visited):
global ans
ans += 1
retur... |
s746079798 | p03805 | u643840641 | 1545545193 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 439 | m, n = map(int, input().split())
edge = [[False for j in range(n)] for i in range(n)]
for _ in range(m):
a, b = map(int, input().split())
edge[a-1][b-1] = edge[b-1][a-1] = True
visited = [False for _ in range(n)]
ans = 0
def dfs(v):
visited[v] = True
if all(x==True for x in visited):
global ans
ans += 1
retur... |
s821919369 | p03805 | u029329478 | 1542406346 | Python | Python (3.4.3) | py | Runtime Error | 53 | 4332 | 1203 | import copy
class Line:
def __init__(self, a, b):
self.a = a
self.b = b
def generate_patterns(remains, current_pattern, patterns):
if len(remains) == 0:
patterns.append(current_pattern)
return
for remain in remains:
_current_pattern = copy.copy(current_pattern)
... |
s722697617 | p03805 | u029329478 | 1542405863 | Python | Python (3.4.3) | py | Runtime Error | 52 | 4332 | 1171 | import copy
class Line:
def __init__(self, a, b):
self.a = a
self.b = b
def generate_patterns(remains, current_pattern, patterns):
if len(remains) == 0:
patterns.append(current_pattern)
return
for remain in remains:
_current_pattern = copy.copy(current_pattern)
... |
s981123985 | p03805 | u426108351 | 1540330338 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 677 | N, M = map(int, input().split())
A = []
B = []
for i in xrange(M):
a, b = map(int, input().split())
A.append(a)
B.append(b)
for i in xrange(M):
A.append(B[i])
B.append(A[i])
result = []
stack = []
def path(start, visited):
if len(visited) >= N:
if visited not in result:
re... |
s683140295 | p03805 | u426108351 | 1540326766 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 823 | def lensetlist(A):
B = []
for i in A:
if i not in B:
B.append(i)
return len(B)
N, M = map(int, input().split())
A = []
B = []
for i in range(M):
a, b = map(int, input().split())
A.append(a)
B.append(b)
for i in range(M):
A.append(B[i])
B.append(A[i])
result = []
st... |
s228483788 | p03805 | u094565093 | 1538687400 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 319 | N,M=map(int,input().split())
A=[ list(input()) for i in range(N)]
B=[ list(input()) for i in range(M)]
ans='Yes'
for i in range(N-M+1):
for j in range(N-M+1):
for k in range(i,i+M):
for l in range(j,j+M):
if A[k][l]!=B[k-i][l-j]:
ans='No'
print(ans)
|
s259620998 | p03805 | u608088992 | 1538581906 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3064 | 637 | N, M = map(int, input().split())
Edge = [[] for i in range(M)]
for i in range(M):
a, b = map(int, input().split())
a, b = a-1, b-1
Edge[a].append(b)
Edge[b].append(a)
Visited = [False for i in range(N)]
Visited[0] = True
ans = 0
def DFS(i):
allvisited = True
for j in range(N):
if Visite... |
s288863898 | p03805 | u769852547 | 1537153144 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 632 | n, m = map(int, input().split())
ab = [ list(map(int, input().split())) for _ in range(m) ]
graph = [ [False] * 8 for _ in range(8) ]
visited = [False] * n
def dfs(a, N, visited):
finish = True
for i in range(N):
if not visited[i]:
finish = False
if finish:
return 1
ans = 0... |
s419532066 | p03805 | u411858517 | 1536161583 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 613 | N, M = map(int, input().split())
E = [[0 for i in range(N)] for j in range(N)] #頂点のつながり
for i in range(M):
a, b = map(int, input().split())
E[a-1][b-1] = 1
E[b-1][a-1] = 1
V = [ 0 for i in range(N)] #訪問済みの頂点が1
V[0] = 1 #頂点1は訪問済み
def DPS(now, V):
res = 0 #全て訪問できた回数
if 0 not in V:
return 1
... |
s875770532 | p03805 | u366644013 | 1535727499 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3188 | 418 | import itertools
na = lambda: list(map(int, input().split()))
n, m = na()
t = [[0] * 10 for _ in range(10)]
for _ in range(m):
a, b = na()
a -= 1
b -= 1
t[a][b] = t[b][a] = 1
ans = 0
for l in itertools.permutations(range(m)):
if l[0]: continue
flag = 1
for i in range(1, n):
if t[l[... |
s549176978 | p03805 | u366644013 | 1535727316 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 400 | import itertools
na = lambda: list(map(int, input().split()))
n, m = na()
t = [[0] * 10 for _ in range(10)]
for _ in range(m):
a, b = na()
a -= 1
b -= 1
t[a][b] = t[b][a] = 1
ans = 0
for l in itertools.permutations(range(m)):
if l[0]: continue
flag = 1
for i in range(1, n):
if t[l[... |
s089060629 | p03805 | u108617242 | 1535593167 | Python | Python (3.4.3) | py | Runtime Error | 105 | 3444 | 674 | import copy
def explore(key, flags):
flags = copy.copy(flags)
if flags[key-1]:
return 0
flags[key-1] = True
if False not in flags:
return 1
elif key in graph:
value = graph[key]
ans = 0
for i in value:
ans += explore(i, flags)
return ans
... |
s267868736 | p03805 | u118605645 | 1534338789 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 576 | def search(node):
global ans
if sum(is_visit) == n:
ans += 1
for i in range(n):
if is_neighbor[node][i]:
if not is_visit[i]:
is_visit[i] = True
search(i)
is_visit[i] = False
n, m = map(int, input().split())
is_neighbor = [[False... |
s657224927 | p03805 | u140251125 | 1533261780 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 488 | # input
N, M = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(M)]
edges = [set() for _ in range(N)]
for a, b in G:
edges[a - 1].add((b - 1, 1))
edges[b - 1].add((a - 1, 1))
def dfs(start, edges, path):
path.append(start)
if len(path) == n:
path.pop()
retu... |
s754752454 | p03805 | u858523893 | 1531063652 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 296 | from itertools import permutations
n, m = map(int, input().split())
paths = set()
for i in range(n) :
_a, _b = map(int, input().split())
# paths.add((_a, _b))
# paths.add((_b, _a))
# print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
|
s672372895 | p03805 | u858523893 | 1531063469 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 292 | from itertools import permutations
n, m = map(int, input().split())
paths = set()
for i in range(n) :
_a, _b = map(int, input().split())
paths.add((_a, _b))
paths.add((_b, _a))
# print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
|
s786748614 | p03805 | u858523893 | 1531017926 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3060 | 290 | from itertools import permutations
n, m = map(int, input().split())
paths = set()
for i in range(n) :
_a, _b = map(int, input().split())
paths.add((_a, _b))
paths.add((_b, _a))
print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
|
s359495497 | p03805 | u858523893 | 1531017625 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 314 | from itertools import permutations
n, m = map(int, input().split())
# a, b = [], []
paths = set()
for i in range(n) :
_a, _b = map(int, input().split())
paths.add((_a, _b))
paths.add((_b, _a))
print(sum(all((s, t) in paths for s, t in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
|
s818146637 | p03805 | u858523893 | 1531017463 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 388 | from itertools import permutations
n, m = map(int, input().split())
a, b = [], []
for i in range(n) :
_a, _b = map(int, input().split())
a.append(_a)
b.append(_b)
# create set
paths = set()
for i in range(m) :
paths.add((a[i], b[i]))
paths.add((b[i], a[i]))
print(sum(all((s, t) in paths for ... |
s126672763 | p03805 | u162660367 | 1530545975 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 551 | import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
graph=[[False]*N for i in range(N)]
for i in range(N):
a,b=list(map(int, input().split()))
graph[a-1][b-1]=True
graph[b-1][a-1]=True
visited=[False]*N
def dfs(v,visited):
if all(visited):
return 1
ret=0
for i in r... |
s579641767 | p03805 | u162660367 | 1530545500 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 535 | from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
a,b=list(map(int, input().split()))
links[a].append(b)
links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
global visited
if all(visited):
... |
s862382901 | p03805 | u162660367 | 1530545125 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3444 | 492 | from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
a,b=list(map(int, input().split()))
links[a].append(b)
links[b].append(a)
ct=0
def DFS(idx,visited):
visited.add(idx)
for i in links[idx]:
... |
s050802859 | p03805 | u856232850 | 1529533847 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 584 | import itertools
n,m = list(map(int,input().split()))
a = []
for i in range(m):
b = (list(map(int,input().split())))
b = [b[0]-1,b[1]-1]
a.append(b)
b = [[0 for i in range(n)] for j in range(n)]
for i in a:
b[i[0]][i[1]] = 1
b[i[1]][i[0]] = 1
c = [i+1 for i in range(m-1)]
ans = 0
for i in itertoo... |
s882177668 | p03805 | u136090046 | 1528929370 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 647 | import sys
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
if m == 0:
print(0)
sys.exit()
adj_array = [[] for x in range(m + 1)]
res_array = [True] + [False for x in range(n)]
for item in array:
adj_array[item[0]].append(item[1])
adj_array[item[1]].appe... |
s058531577 | p03805 | u136090046 | 1528853476 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 595 | n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
adj_array = [[] for x in range(m + 1)]
res_array = [True] + [False for x in range(n)]
for item in array:
adj_array[item[0]].append(item[1])
adj_array[item[1]].append(item[0])
def dfs(n, res_array, res):
res_ar... |
s665584193 | p03805 | u136090046 | 1528852657 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3064 | 595 | n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
adj_array = [[] for x in range(m + 1)]
res_array = [True] + [False for x in range(m)]
for item in array:
adj_array[item[0]].append(item[1])
adj_array[item[1]].append(item[0])
def dfs(n, res_array, res):
res_ar... |
s149642657 | p03805 | u226108478 | 1528075859 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3316 | 806 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
# See:
# https://atcoder.jp/img/abc054/editorial.pdf
def dfs(v):
all_visited = True
if False in visited:
all_visited = False
if all_visited:
return 1
count = 0
for i in range(n):
if graph[v][i] == 0:
... |
s830057508 | p03805 | u226108478 | 1528073057 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3188 | 997 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
def dfs(pos, mask):
if pos == n:
if len(set(p)) == n:
pass_count = 1
for i in range(n - 1):
if graph[p[i]][p[i + 1]] == 1:
pass_count += 1
if pass_count == n:
... |
s850261693 | p03805 | u226108478 | 1527907108 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 688 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
def dfs(i: int):
if visited[i]:
return
visited[i] = True
for k in range(n):
if graph[i][k] == 1:
dfs(k)
if __name__ == '__main__':
n, m = list(map(int, input().split()))
ab = [list(map(lambda x: int(x) ... |
s102264496 | p03805 | u813450984 | 1527184252 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1050 | n, m = map(int, input().split())
l = []
combo = []
for i in range(max(n, m) + 1):
l.append([])
def dfs(path, now):
if len(set(path)) == n and not path in combo:
combo.append(path)
return
for i in l[now]:
if not i in path:
temp = path[:]
temp.append(i)
dfs(temp, i)
return
if m ==... |
s557168054 | p03805 | u813450984 | 1527183876 | Python | Python (3.4.3) | py | Runtime Error | 437 | 3828 | 514 | n, m = map(int, input().split())
l = []
for i in range(m+1):
l.append([])
types = set()
combo = []
for i in range(m):
f, t = map(int, input().split())
if not t in l[f]:
l[f].append(t)
if not f in l[t]:
l[t].append(f)
def dfs(path, now):
if len(set(path)) == n and not path in combo:
combo.appen... |
s404304809 | p03805 | u813450984 | 1527183725 | Python | Python (3.4.3) | py | Runtime Error | 430 | 3828 | 482 | n, m = map(int, input().split())
l = []
for i in range(m+1):
l.append([])
types = set()
combo = []
for i in range(m):
f, t = map(int, input().split())
if not t in l[f]:
l[f].append(t)
if not f in l[t]:
l[t].append(f)
def dfs(path, now):
if len(set(path)) == n and not path in combo:
combo.appen... |
s028982451 | p03805 | u503901534 | 1526966038 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 689 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]
for _ in range(m):
a, b = map(int,input().split())
edge_list.append([a-1,b-1])
H[a-1][b-1] = 1
H[b-1][a-1] = 1
l = [0 for _ in range(n)]
ans = 0
def dfs(node,visited):
... |
s368221068 | p03805 | u503901534 | 1526965930 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 642 | n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]
for _ in range(m):
a, b = map(int,input().split())
edge_list.append([a-1,b-1])
H[a-1][b-1] = 1
H[b-1][a-1] = 1
l = [0 for _ in range(n)]
ans = 0
def dfs(node,visited):
global ans
if visited.count(0) == 0:
... |
s391444038 | p03805 | u503901534 | 1526965899 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 657 | n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]
for _ in range(m):
a, b = map(int,input().split())
edge_list.append([a-1,b-1])
H[a-1][b-1] = 1
H[b-1][a-1] = 1
l = [0 for _ in range(n)]
ans = 0
def dfs(node,visited):
global ans
if visited.count(0) == 0:
... |
s463865893 | p03805 | u503901534 | 1526965869 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 658 | n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]
for _ in range(m):
a, b = map(int,input().split())
edge_list.append([a-1,b-1])
H[a-1][b-1] = 1
H[b-1][a-1] = 1
l = [0 for _ in range(n)]
ans = 0
def dfs(node,visited):
global ans
if visited.count(0) == 0:
... |
s380031187 | p03805 | u879302598 | 1526770570 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 622 | from itertools import permutations
def f(n, m, uu, vv):
a = [[0] * n for _ in range(n)]
for u, v in zip(uu, vv):
a[u][v] = 1
a[v][u] = 1
res = 0
for p in permutations(range(n)):
if p[0] != 0:
break
ok = True
for i in range(n-1):。
if a[p[i]... |
s730652573 | p03805 | u136090046 | 1525557530 | Python | Python (3.4.3) | py | Runtime Error | 47 | 3064 | 685 | import sys
sys.setrecursionlimit(50000)
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for x in range(m)]
if m == 0 or m == 1:
print(1)
sys.exit()
adjacency_list = [[] for x in range(n + 1)]
for i in array:
adjacency_list[i[0]].append(i[1])
adjacency_list[i[1]].append(i... |
s096402867 | p03805 | u583010173 | 1524643032 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 480 | # -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*n for i in range(n)]
visited = [0]*n
for i in range(n):
a, b = [int(x) for x in input().split()]
adj[a-1][b-1] = 1
adj[b-1][a-1] = 1
ans = 0
def dfs(v):
global ans
if sum(visited) == n:
ans += 1
for i in range(n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.