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.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex with one of three numbers 1, 2 or 3 in such way, ... | instruction | 0 | 40,582 | 13 | 81,164 |
Tags: dfs and similar, dp, graphs
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
N, M = map(int, input().split())
n1, n2, n3 = map(int, input().split())
def check():
graph = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
graph[a-1].append(b-1)... | output | 1 | 40,582 | 13 | 81,165 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,583 | 13 | 81,166 |
Yes | output | 1 | 40,583 | 13 | 81,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,584 | 13 | 81,168 |
Yes | output | 1 | 40,584 | 13 | 81,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,585 | 13 | 81,170 |
Yes | output | 1 | 40,585 | 13 | 81,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,586 | 13 | 81,172 |
Yes | output | 1 | 40,586 | 13 | 81,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,587 | 13 | 81,174 |
No | output | 1 | 40,587 | 13 | 81,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,588 | 13 | 81,176 |
No | output | 1 | 40,588 | 13 | 81,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,589 | 13 | 81,178 |
No | output | 1 | 40,589 | 13 | 81,179 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n_1, n_2 and n_3.
Can you label each vertex wi... | instruction | 0 | 40,590 | 13 | 81,180 |
No | output | 1 | 40,590 | 13 | 81,181 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,675 | 13 | 81,350 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
def solve():
MOD = 10**9+7
inv2 = (MOD+1)//2
n = int(input())
#graph = [[] for i in range(n)]
dist = [[n]*n for i in range(n)]
for i in range(n):
dist[i][i] = 0
for i in range(n-1):
... | output | 1 | 40,675 | 13 | 81,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,676 | 13 | 81,352 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
import sys, os
from collections import defaultdict
from queue import Queue
if os.environ['USERNAME']=='kissz':
inp=open('in.txt','r').readline
def debug(*args):
print(*args,file=sys.stderr)
else:
inp=sys.... | output | 1 | 40,676 | 13 | 81,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,677 | 13 | 81,354 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
mod = 10 ** 9 + 7
N = int(input())
E = []
for _ in range(N - 1):
x, y = map(int, input().split())
x, y = x-1, y-1
E.append((x... | output | 1 | 40,677 | 13 | 81,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,678 | 13 | 81,356 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import deque
MOD = 10 ** 9 + 7
N = 1000
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
fact[i] = fact[i - 1] * i % MOD... | output | 1 | 40,678 | 13 | 81,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,679 | 13 | 81,358 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
mod = 10**9 + 7
def power(a, b):
if b == 0: return 1
s = power(a, b >> 1)
s = s * s % mod
if b&1: return (s * a % mod)
return s
n = int(input())
d = [[10**9 for i in range(n)] for i in range(n)]
for i in ... | output | 1 | 40,679 | 13 | 81,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,680 | 13 | 81,360 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
n=int(input())
N=n
mod=10**9+7
E=[[] for i in range(n)]
for i in range(n-1):
x,y=map(int,input().split())
x-=1
y-=1
E[x].append(y)
E[y].append(x)
INV2=pow(2,mod-2,m... | output | 1 | 40,680 | 13 | 81,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,681 | 13 | 81,362 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
import sys
from sys import stdin
from collections import deque
def NC_Dij(lis,start):
ret = [float("inf")] * len(lis)
ret[start] = 0
q = deque([start])
plis = [i for i in range(len(lis))]
while len... | output | 1 | 40,681 | 13 | 81,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.
After that, until all nodes a... | instruction | 0 | 40,682 | 13 | 81,364 |
Tags: brute force, combinatorics, dp, graphs, math, probabilities, trees
Correct Solution:
```
from sys import stdin, stdout
# 1 -> 2 -> 3 -> 4 -> 5 -> 6
# 2^4 = (2^3) + (2^3)
def dfs(cur, pre, d, dic, dep_a, jmp_a):
dep_a[cur] = d
jmp_a[cur][0] = pre
for i in range(1, 10):
jmp_a[cur][i] = jmp_a[... | output | 1 | 40,682 | 13 | 81,365 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,683 | 13 | 81,366 |
Yes | output | 1 | 40,683 | 13 | 81,367 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,684 | 13 | 81,368 |
Yes | output | 1 | 40,684 | 13 | 81,369 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,685 | 13 | 81,370 |
Yes | output | 1 | 40,685 | 13 | 81,371 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,686 | 13 | 81,372 |
No | output | 1 | 40,686 | 13 | 81,373 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,687 | 13 | 81,374 |
No | output | 1 | 40,687 | 13 | 81,375 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,688 | 13 | 81,376 |
No | output | 1 | 40,688 | 13 | 81,377 |
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 consisting of n nodes. You generate an array from the tree by marking nodes one by one.
Initially, when no nodes are marked, a node is equiprobably chosen and marked from t... | instruction | 0 | 40,689 | 13 | 81,378 |
No | output | 1 | 40,689 | 13 | 81,379 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,959 | 13 | 81,918 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
n, a, b = map(int, input().split())
if min(a, b) > 1 or 1 < n < 4 and max(a, b) == 1:
print('NO')
exit()
print('YES')
f = int(a == 1)
g = [a, b][f]
r = [[f] * n for i in range(n)]
for i in range(n):
r[i][i] = 0
for i in range(n - g)... | output | 1 | 40,959 | 13 | 81,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,960 | 13 | 81,920 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
str=input().split()
n,a,b=[int(str[x]) for x in range(0,3)]
inv=0
if (b!=1):
t=a
a=b
b=t
inv=1
if (b!=1 or n>1 and n<4 and a==1 and b==1):
print ('NO')
exit()
print ('YES')
f=[[0]*n for i in range(0,n)]
#print (f)
for i in range(... | output | 1 | 40,960 | 13 | 81,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,961 | 13 | 81,922 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
def generate_matrix(n):
result = [[0 for c in range(n)] for y in range(n)]
return result
def generate_m_component_matrix(n, comp):
result = generate_matrix(n)
for i in range(0, n - comp + 1):
for j in range(0, n - comp... | output | 1 | 40,961 | 13 | 81,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,962 | 13 | 81,924 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
# Educational Codeforces Round 45 (Rated for Div. 2)
import collections
from functools import cmp_to_key
#key=cmp_to_key(lambda x,y: 1 if x not in y else -1 )
import sys
def getIntList():
return list(map(int, input().split()))
... | output | 1 | 40,962 | 13 | 81,925 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,963 | 13 | 81,926 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
n, a, b = map(int, input().split())
if min(a, b) > 1 or 1 < n < 4 and max(a, b) == 1:
print('NO')
exit()
print('YES')
f = int(a == 1)
g = [a, b][f]
r = [[f] * n for i in range(n)]
for i in range(n):
r[i][i] = 0
for i in range(n - g)... | output | 1 | 40,963 | 13 | 81,927 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,964 | 13 | 81,928 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
def generate_matrix(n):
result = [[0 for x in range(n)] for y in range(n)]
return result
def generate_m_component_matrix(n, comp):
result = generate_matrix(n)
for i in range(0, n - comp + 1):
for j in range(0, n - comp ... | output | 1 | 40,964 | 13 | 81,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,965 | 13 | 81,930 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
def ii():
return int(input())
def mi():
return map(int, input().split())
def li():
return list(mi())
n, a, b = mi()
c = max(a, b)
if a != 1 and b != 1:
print('NO')
elif n == 2 and c == 1:
print('NO')
elif n == 3 and c == 1:... | output | 1 | 40,965 | 13 | 81,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is b. The matrix must be symmetric, and all digit... | instruction | 0 | 40,966 | 13 | 81,932 |
Tags: constructive algorithms, graphs, implementation
Correct Solution:
```
def read():
return int(input())
def readlist():
return list(map(int, input().split()))
def readmap():
return map(int, input().split())
N, A, B = readmap()
if N == 1:
print("YES")
print(0)
elif N == 2:
if A == 1 a... | output | 1 | 40,966 | 13 | 81,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,967 | 13 | 81,934 |
Yes | output | 1 | 40,967 | 13 | 81,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,968 | 13 | 81,936 |
Yes | output | 1 | 40,968 | 13 | 81,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,969 | 13 | 81,938 |
Yes | output | 1 | 40,969 | 13 | 81,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,970 | 13 | 81,940 |
Yes | output | 1 | 40,970 | 13 | 81,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,971 | 13 | 81,942 |
No | output | 1 | 40,971 | 13 | 81,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,972 | 13 | 81,944 |
No | output | 1 | 40,972 | 13 | 81,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,973 | 13 | 81,946 |
No | output | 1 | 40,973 | 13 | 81,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given three numbers n, a, b. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to a, and the number of components in its complement is... | instruction | 0 | 40,974 | 13 | 81,948 |
No | output | 1 | 40,974 | 13 | 81,949 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A subgraph of a graph is some set of the graph ver... | instruction | 0 | 41,245 | 13 | 82,490 |
Tags: flows, graphs
Correct Solution:
```
class edge(object):
def __init__(self,ne,to,fl):
self.ne=ne
self.to=to
self.fl=fl
def add(x,y,z):
global tot
tot+=1
e.append(edge(he[x],y,z))
he[x]=tot
def addedge(x,y,z):
add(x,y,z)
add(y,x,0)
def bfs():
global deep
deep=[0 for i in range(T+1)]
q=[]
q.appen... | output | 1 | 41,245 | 13 | 82,491 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A subgraph of a graph is some set of the graph ver... | instruction | 0 | 41,246 | 13 | 82,492 |
Tags: flows, graphs
Correct Solution:
```
class edge(object):
def __init__(self,ne,to,fl):
self.ne=ne
self.to=to
self.fl=fl
def add(x,y,z):
global tot
tot+=1
e.append(edge(he[x],y,z))
he[x]=tot
def addedge(x,y,z):
add(x,y,z)
add(y,x,0)
def bfs():
global deep
deep=[0 for i in range(T+1)]
q=[]
q.appen... | output | 1 | 41,246 | 13 | 82,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A subgraph of a graph is some set of the graph ver... | instruction | 0 | 41,247 | 13 | 82,494 |
Tags: flows, graphs
Correct Solution:
```
from collections import deque
def addedge(u, v, value):
global e
a = [v, value, None]
b = [u, 0, a]
a[2] = b
e[u].append(a)
e[v].append(b)
inf = 2 * (10 ** 12)
ans = 0
n, m = map(int, input().split())
e = [[] for i in range(n + m + 2)]
a = tuple(map(int, input().split... | output | 1 | 41,247 | 13 | 82,495 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A subgraph of a graph is some set of the graph ver... | instruction | 0 | 41,248 | 13 | 82,496 |
Tags: flows, graphs
Correct Solution:
```
import sys
class Graph:
verticies = {}
nodesCount = 0
class Vertex:
def __init__(self, label, endPoint=None):
self.label = label
self.edges = []
self.visitedToken = 0
self.endPoint = endPoint
class Edge:
... | output | 1 | 41,248 | 13 | 82,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A s... | instruction | 0 | 41,249 | 13 | 82,498 |
No | output | 1 | 41,249 | 13 | 82,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A s... | instruction | 0 | 41,250 | 13 | 82,500 |
No | output | 1 | 41,250 | 13 | 82,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.
The weight of the i-th vertex is a_i.
The weight of the i-th edge is w_i.
A s... | instruction | 0 | 41,251 | 13 | 82,502 |
No | output | 1 | 41,251 | 13 | 82,503 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree with n vertices. Each vertex i has a value a_i associated with it.
Let us root the tree at some vertex v. The vertex v is called a distinctive root if the following holds: in all paths that start at v and end at some ot... | instruction | 0 | 41,481 | 13 | 82,962 |
Tags: data structures, dfs and similar, dp, trees
Correct Solution:
```
import io, os
from collections import Counter, defaultdict, deque
class LazySegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the lazy segment tree with data"""
_default = default
self._func = fu... | output | 1 | 41,481 | 13 | 82,963 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree with n vertices. Each vertex i has a value a_i associated with it.
Let us root the tree at some vertex v. The vertex v is called a distinctive root if the following holds: in all paths that start at v and end at some ot... | instruction | 0 | 41,482 | 13 | 82,964 |
Tags: data structures, dfs and similar, dp, trees
Correct Solution:
```
import io, os
from collections import Counter, defaultdict, deque
class LazySegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the lazy segment tree with data"""
_default = default
self._func = fu... | output | 1 | 41,482 | 13 | 82,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a tree with n vertices. Each vertex i has a value a_i associated with it.
Let us root the tree at some vertex v. The vertex v is called a distinctive root if the following holds: in all paths that start at v and end at some ot... | instruction | 0 | 41,483 | 13 | 82,966 |
Tags: data structures, dfs and similar, dp, trees
Correct Solution:
```
import io, os;from collections import Counter, defaultdict, deque
class LazySegmentTree:
def __init__(self, data, default=0, func=max):
_default = default
self._func = func
self._len = len(data)
self._size = _s... | output | 1 | 41,483 | 13 | 82,967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.