message stringlengths 2 49.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 446 108k | cluster float64 13 13 | __index_level_0__ int64 892 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n.
Nauuo wants to dr... | instruction | 0 | 35,219 | 13 | 70,438 |
Tags: combinatorics, dfs and similar, dp, trees
Correct Solution:
```
n=int(input())
d=[0]*2*n
for i in range(n-1):
u,v=map(int,input().split())
d[u]+=1
d[v]+=1
n=n*d[u]*d[v]%998244353
print(n)
``` | output | 1 | 35,219 | 13 | 70,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n.
Nauuo wants to dr... | instruction | 0 | 35,220 | 13 | 70,440 |
Tags: combinatorics, dfs and similar, dp, trees
Correct Solution:
```
import sys
def topological_sort_tree(E, p):
Q = [p]
L = []
visited = set([p])
while Q:
p = Q.pop()
L.append(p)
for vf in E[p]:
if vf not in visited:
visited.add(vf)
... | output | 1 | 35,220 | 13 | 70,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n.
Nauuo wants to dr... | instruction | 0 | 35,221 | 13 | 70,442 |
Tags: combinatorics, dfs and similar, dp, trees
Correct Solution:
```
from math import *
from collections import *
import sys
sys.setrecursionlimit(10**9)
mod = 998244353
n = int(input())
a = [0 for i in range(n+1)]
ans = n
for i in range(n-1):
u,v = map(int,input().split())
a[u] += 1
a[v] += 1
ans *= a[u]
ans %=... | output | 1 | 35,221 | 13 | 70,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n.
Nauuo wants to dr... | instruction | 0 | 35,222 | 13 | 70,444 |
Tags: combinatorics, dfs and similar, dp, trees
Correct Solution:
```
import io, os
#input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
g = [0] * 200005
r = int(input())
n = r
for i in range(1, n):
u, v = map(int, input().split())
g[u] += 1
g[v] += 1
r *= g[u] * g[v]
r %= 998244353
print(r... | output | 1 | 35,222 | 13 | 70,445 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n.
Nauuo wants to dr... | instruction | 0 | 35,223 | 13 | 70,446 |
Tags: combinatorics, dfs and similar, dp, trees
Correct Solution:
```
import sys
from collections import deque
mod = 998244353
frac = [1]*364364
for i in range(2,364364):
frac[i] = i * frac[i-1]%mod
N = int(input())
Dim = [0]*N
Edge = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, sys.stdin.rea... | output | 1 | 35,223 | 13 | 70,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,224 | 13 | 70,448 |
Yes | output | 1 | 35,224 | 13 | 70,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,225 | 13 | 70,450 |
Yes | output | 1 | 35,225 | 13 | 70,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,226 | 13 | 70,452 |
Yes | output | 1 | 35,226 | 13 | 70,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,227 | 13 | 70,454 |
Yes | output | 1 | 35,227 | 13 | 70,455 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,228 | 13 | 70,456 |
No | output | 1 | 35,228 | 13 | 70,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,229 | 13 | 70,458 |
No | output | 1 | 35,229 | 13 | 70,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,230 | 13 | 70,460 |
No | output | 1 | 35,230 | 13 | 70,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves drawing circles.
One day she has drawn a circle and wanted to draw a tree on it.
The tree is a connected undirected graph consisting of n nodes and n-1 edges. The nod... | instruction | 0 | 35,231 | 13 | 70,462 |
No | output | 1 | 35,231 | 13 | 70,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with each vertex coloured white, black or grey. You can remove elements from the tree by selecting a subset of vertices in a single connected component and removing them and... | instruction | 0 | 35,384 | 13 | 70,768 |
No | output | 1 | 35,384 | 13 | 70,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with each vertex coloured white, black or grey. You can remove elements from the tree by selecting a subset of vertices in a single connected component and removing them and... | instruction | 0 | 35,385 | 13 | 70,770 |
No | output | 1 | 35,385 | 13 | 70,771 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with each vertex coloured white, black or grey. You can remove elements from the tree by selecting a subset of vertices in a single connected component and removing them and... | instruction | 0 | 35,386 | 13 | 70,772 |
No | output | 1 | 35,386 | 13 | 70,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with each vertex coloured white, black or grey. You can remove elements from the tree by selecting a subset of vertices in a single connected component and removing them and... | instruction | 0 | 35,387 | 13 | 70,774 |
No | output | 1 | 35,387 | 13 | 70,775 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,857 | 13 | 71,714 |
"Correct Solution:
```
N = int(input())
edge = [{} for _ in range(N+1)]
dist = [-1]*(N+1)
for _ in range(N-1):
a,b,c = map(int,input().split())
edge[a][b] = c
edge[b][a] = c
Q,K = map(int,input().split())
dist[K] = 0
dfs_stack = [K]
while dfs_stack:
s = dfs_stack.pop()
for t,t_dist in edge[s].items(... | output | 1 | 35,857 | 13 | 71,715 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,858 | 13 | 71,716 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
N = int(input())
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(Q)]
G = [[] * N for _ in range(N)]
for a, b, c in ABC:
G[a - 1].append((b - 1, c))
G[b... | output | 1 | 35,858 | 13 | 71,717 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,859 | 13 | 71,718 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**9)
N = int(input())
T = [[] for _ in range(N+1)]
for _ in range(N-1) :
a,b,c = map(int,input().split())
T[a].append([b,c])
T[b].append([a,c])
Q,K = map(int,input().split())
dist = [None]*(N+1)
def dfs(now,d) :
dist[now] = d
for to,c in... | output | 1 | 35,859 | 13 | 71,719 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,860 | 13 | 71,720 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**7)
N=int(input())
NODES={}
for i in range(N-1):
a,b,c=map(int,input().split())
if not a in NODES: NODES[a] = []
if not b in NODES: NODES[b] = []
NODES[a].append((b, c))
NODES[b].append((a, c))
Q,K=map(int,input().split())
MP=[-1]*(N+1)
MP... | output | 1 | 35,860 | 13 | 71,721 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,861 | 13 | 71,722 |
"Correct Solution:
```
from collections import deque
INF=float('inf')
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
u,v,w=map(int,input().split())
g[u-1].append((v-1,w))
g[v-1].append((u-1,w))
q,k=map(int,input().split())
ds=[INF]*n
que=deque([(k-1,0)])
while len(que):
u,d=que.popleft(... | output | 1 | 35,861 | 13 | 71,723 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,862 | 13 | 71,724 |
"Correct Solution:
```
n=int(input())
G=[[] for i in range(n)]
for i in range(n-1):
u,v,w=map(int,input().split())
G[u-1].append([v-1,w])
G[v-1].append([u-1,w])
dist=[-1]*n
from collections import deque
Q,k=map(int,input().split())
q=deque()
q.append(k-1)
dist[k-1]=0
while q:
cur=q.popleft()
for nx,nd in G[cu... | output | 1 | 35,862 | 13 | 71,725 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,863 | 13 | 71,726 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(4100000)
N = int(input())
INF = 10 ** 14
edges = [[] for _ in range(N)]
for _ in range(N-1):
a, b, c = map(int,input().split())
edges[a-1].append((b-1, c))
edges[b-1].append((a-1, c))
Q, K = map(int,input().split())
d = [INF] * N
d[K-1] = 0
def dfs(... | output | 1 | 35,863 | 13 | 71,727 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length ... | instruction | 0 | 35,864 | 13 | 71,728 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
n = int(input())
inf = float("inf")
road = [dict() for _ in range(n+1)]
for _ in range(n-1):
a,b,c = map(int, input().split())
road[a][b] = c
road[b][a] = c
q,k = map(int, input().split())
dfs = [inf]*(n+1)
dfs[k] = 0
def dodfs(x):
for i in road[x]:... | output | 1 | 35,864 | 13 | 71,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,865 | 13 | 71,730 |
Yes | output | 1 | 35,865 | 13 | 71,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,866 | 13 | 71,732 |
Yes | output | 1 | 35,866 | 13 | 71,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,867 | 13 | 71,734 |
Yes | output | 1 | 35,867 | 13 | 71,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,868 | 13 | 71,736 |
Yes | output | 1 | 35,868 | 13 | 71,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,869 | 13 | 71,738 |
No | output | 1 | 35,869 | 13 | 71,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,870 | 13 | 71,740 |
No | output | 1 | 35,870 | 13 | 71,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,871 | 13 | 71,742 |
No | output | 1 | 35,871 | 13 | 71,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1... | instruction | 0 | 35,872 | 13 | 71,744 |
No | output | 1 | 35,872 | 13 | 71,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,110 | 13 | 72,220 |
Tags: trees
Correct Solution:
```
import collections
def add_on_tree():
n = int(input())
edges = []
for i in range(n-1): edges.append([int(x) for x in input().split()])
graph = collections.defaultdict(set)
for u, v in edges:
graph[u].add(v)
graph[v].add(u)
ans = 'YES'
for nod... | output | 1 | 36,110 | 13 | 72,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,111 | 13 | 72,222 |
Tags: trees
Correct Solution:
```
n = int(input())
a = []
for i in range(0,n+9):
a.append(0)
for i in range(1,n):
u,v = map(int,input().split())
a[u] = a[u]+1
a[v] = a[v]+1
flag = 1;
for i in range(1,n+1):
if a[i]==2:
flag = 0
if flag==0:
print("NO")
else:
print("YES")
``` | output | 1 | 36,111 | 13 | 72,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,112 | 13 | 72,224 |
Tags: trees
Correct Solution:
```
if __name__ == '__main__':
n = int(input())
g = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = map(int, input().split())
g[u - 1].append(v - 1)
g[v - 1].append(u - 1)
if list(filter(lambda x: len(x) == 2, g)):
print("NO")
else... | output | 1 | 36,112 | 13 | 72,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,113 | 13 | 72,226 |
Tags: trees
Correct Solution:
```
from math import log2
from collections import defaultdict
import sys
input = sys.stdin.readline
'''
for CASES in range(int(input())):
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
sys.stdout.write(" ".join(map(str,ans))+"\n")
... | output | 1 | 36,113 | 13 | 72,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,114 | 13 | 72,228 |
Tags: trees
Correct Solution:
```
import math
def main():
n = int(input())
g = []
for _ in range(n):
g.append([])
for _ in range(n-1):
u, v = map(lambda x: int(x) - 1, input().split())
g[u].append(v)
g[v].append(u)
ok = True
for i in range(n):
if len(g[i... | output | 1 | 36,114 | 13 | 72,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,115 | 13 | 72,230 |
Tags: trees
Correct Solution:
```
from collections import defaultdict
n = int(input())
hash = defaultdict(list)
for i in range(n-1):
a,b = map(int,input().split())
hash[a].append(b)
hash[b].append(a)
flag = 1
for i in hash.keys():
if len(hash[i]) == 2:
flag = 0
break
if flag:
pri... | output | 1 | 36,115 | 13 | 72,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,116 | 13 | 72,232 |
Tags: trees
Correct Solution:
```
I = lambda : map(int,input().split())
n = int(input())
#li = list(I())
if n == 1 or n==2 :
exit(print("YES"))
if n==3 :
exit(print("NO"))
lii = [ [] for i in range (n+1)]
for i in range (n-1) :
x , y = I()
lii[x] += [y]
lii[y] += [x]
pp = 0
for i in range (1,n+1) :... | output | 1 | 36,116 | 13 | 72,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any... | instruction | 0 | 36,117 | 13 | 72,234 |
Tags: trees
Correct Solution:
```
n = int(input())
# n, k = map(int, input().split())
# a = [int(i) for i in input().split()]
d = [0 for i in range(n + 1)]
for i in range(n - 1):
a, b = map(int, input().split())
d[a] += 1; d[b] += 1
for val in d:
if val == 2:
print("NO")
exit()
print("YES")
... | output | 1 | 36,117 | 13 | 72,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,118 | 13 | 72,236 |
Yes | output | 1 | 36,118 | 13 | 72,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,119 | 13 | 72,238 |
Yes | output | 1 | 36,119 | 13 | 72,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,120 | 13 | 72,240 |
Yes | output | 1 | 36,120 | 13 | 72,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,121 | 13 | 72,242 |
Yes | output | 1 | 36,121 | 13 | 72,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,122 | 13 | 72,244 |
No | output | 1 | 36,122 | 13 | 72,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,123 | 13 | 72,246 |
No | output | 1 | 36,123 | 13 | 72,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,124 | 13 | 72,248 |
No | output | 1 | 36,124 | 13 | 72,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.
You are given a tree with n nodes. In the beginning, 0 is written on ... | instruction | 0 | 36,125 | 13 | 72,250 |
No | output | 1 | 36,125 | 13 | 72,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In order to fly to the Moon Mister B just needs to solve the following problem.
There is a complete indirected graph with n vertices. You need to cover it with several simple cycles of length 3 and 4 so that each edge is in exactly 2 cycles... | instruction | 0 | 36,584 | 13 | 73,168 |
Tags: constructive algorithms, graphs
Correct Solution:
```
#!/usr/bin/env python3
from collections import defaultdict
DEBUG = False
def main():
if DEBUG:
test()
n = int(input())
paths = cycles(n)
print(len(paths))
for p in paths:
print('%d %s' % (len(p), ' '.join([str(v) for ... | output | 1 | 36,584 | 13 | 73,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.