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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a n... | instruction | 0 | 51,770 | 13 | 103,540 |
No | output | 1 | 51,770 | 13 | 103,541 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a n... | instruction | 0 | 51,771 | 13 | 103,542 |
No | output | 1 | 51,771 | 13 | 103,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a n... | instruction | 0 | 51,772 | 13 | 103,544 |
No | output | 1 | 51,772 | 13 | 103,545 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,154 | 13 | 104,308 |
"Correct Solution:
```
from collections import deque
class Dinic(object):
__slots__ = ["inf", "v_count", "edges", "iter", "level"]
def __init__(self, v_count: int, edges: list):
self.inf = 10**9
self.v_count = v_count
self.edges = [[] for _ in [0]*v_count]
self.iter = [0]*v_co... | output | 1 | 52,154 | 13 | 104,309 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,155 | 13 | 104,310 |
"Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def graph_dfs(current, matching, visited):
for target in range(y_num):
if (not visited[target]) and (target in adj_table[current]):
visited[target] = True
... | output | 1 | 52,155 | 13 | 104,311 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,156 | 13 | 104,312 |
"Correct Solution:
```
from typing import Set
def dfs(s: int) -> bool:
return _dfs(s, set())
def _dfs(v: int, visited: Set[int]) -> bool:
for u in edges[v]:
if u in visited:
continue
visited.add(u)
if matched[u] == -1 or _dfs(matched[u], visited):
matched[u] =... | output | 1 | 52,156 | 13 | 104,313 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,157 | 13 | 104,314 |
"Correct Solution:
```
class BipartiteMatching:
def __init__(self, V):
self.V = V
self.G = [[] for _ in range(V)]
def add_edge(self, u, v):
self.G[u].append(v)
self.G[v].append(u)
def dfs(self, u):
self.used[u] = True
for v in self.G[u]:
w = self... | output | 1 | 52,157 | 13 | 104,315 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,158 | 13 | 104,316 |
"Correct Solution:
```
#フローに帰着、dinic法,dinic法は蟻本
import sys
from collections import deque
sys.setrecursionlimit(200000)
class Dinic:
def __init__(self,v, inf =10**10):
self.v = v
self.inf = inf
self.G = [[] for _ in range(v)]
self.level = [-1]*v#深さ
self.ite = [0]*v#DFSで... | output | 1 | 52,158 | 13 | 104,317 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,159 | 13 | 104,318 |
"Correct Solution:
```
# Acceptance of input
import sys
file_input = sys.stdin
X, Y, E = map(int, file_input.readline().split())
v_num = X + Y + 2
adj_mat = [[0] * (v_num) for i in range(v_num)]
for line in file_input:
x, y = map(int, line.split())
adj_mat[x][X + y] = 1
s = X + Y
t = s + 1
for i in rang... | output | 1 | 52,159 | 13 | 104,319 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,160 | 13 | 104,320 |
"Correct Solution:
```
#!/usr/bin/env python3
# GRL_7_A: Matching - Bipertite Matching
from heapq import heappush, heappop
class Edge:
__slots__ = ('src', 'dest', 'capacity', 'flow', 'cost')
def __init__(self, v, w, capacity, cost=0):
self.src = v
self.dest = w
self.capacity = capac... | output | 1 | 52,160 | 13 | 104,321 |
Provide a correct Python 3 solution for this coding contest problem.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.
A matching M is a subset of edges such that each node ... | instruction | 0 | 52,161 | 13 | 104,322 |
"Correct Solution:
```
import collections
import queue
class Dinic:
def __init__(self, N):
self.N = N
self.edges = collections.defaultdict(list)
self.level = [0 for _ in range(self.N)]
self.iter = [0 for _ in range(self.N)]
def add(self, u, v, c, directed=True):
"""
... | output | 1 | 52,161 | 13 | 104,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,162 | 13 | 104,324 |
Yes | output | 1 | 52,162 | 13 | 104,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,163 | 13 | 104,326 |
Yes | output | 1 | 52,163 | 13 | 104,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,164 | 13 | 104,328 |
Yes | output | 1 | 52,164 | 13 | 104,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,165 | 13 | 104,330 |
Yes | output | 1 | 52,165 | 13 | 104,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,166 | 13 | 104,332 |
No | output | 1 | 52,166 | 13 | 104,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,167 | 13 | 104,334 |
No | output | 1 | 52,167 | 13 | 104,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,168 | 13 | 104,336 |
No | output | 1 | 52,168 | 13 | 104,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.... | instruction | 0 | 52,169 | 13 | 104,338 |
No | output | 1 | 52,169 | 13 | 104,339 |
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 connected graph consisting of n vertices and m edges. k vertices of this graph are special.
You have to direct each edge of this graph or leave it undirected. If you... | instruction | 0 | 52,408 | 13 | 104,816 |
No | output | 1 | 52,408 | 13 | 104,817 |
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 connected graph consisting of n vertices and m edges. k vertices of this graph are special.
You have to direct each edge of this graph or leave it undirected. If you... | instruction | 0 | 52,409 | 13 | 104,818 |
No | output | 1 | 52,409 | 13 | 104,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of two subproblems: for solving subproblem E1 you will receive 11 points, and for solving subproblem E2 you will receive 13 points.
A tree is an undirected connected graph... | instruction | 0 | 52,552 | 13 | 105,104 |
No | output | 1 | 52,552 | 13 | 105,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of two subproblems: for solving subproblem E1 you will receive 11 points, and for solving subproblem E2 you will receive 13 points.
A tree is an undirected connected graph... | instruction | 0 | 52,553 | 13 | 105,106 |
No | output | 1 | 52,553 | 13 | 105,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Genos and Saitama went shopping for Christmas trees. However, a different type of tree caught their attention, the exalted Power Tree.
A Power Tree starts out as a single root vertex indexed 1... | instruction | 0 | 52,626 | 13 | 105,252 |
No | output | 1 | 52,626 | 13 | 105,253 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,695 | 13 | 105,390 |
Tags: dfs and similar, graphs
Correct Solution:
```
def dfs(vertex, summ, has_capital, am):
summ += len(neigh[vertex])
am += 1
if vertex in capitals:
has_capital = True
used[vertex] = True
for nei in neigh[vertex]:
if not used[nei]:
tmp_c, am, summ = dfs(nei, summ, has_ca... | output | 1 | 52,695 | 13 | 105,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,696 | 13 | 105,392 |
Tags: dfs and similar, graphs
Correct Solution:
```
def dfs(l):
used[l] = True
global comp, reb
comp += 1
reb += len(graph[l])
for f in graph[l]:
if not used[f]:
dfs(f)
n, m, k = map(int, input().split())
capitals = list(map(int, input().split()))
graph = [[] for _ in range(n)]... | output | 1 | 52,696 | 13 | 105,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,697 | 13 | 105,394 |
Tags: dfs and similar, graphs
Correct Solution:
```
def cin():
return list(map(int, input().split()))
def dfs(n):
if not C[n]:
C[n]=True
s[0]+=1
for i in B[n]:
if not C[i]:dfs(i)
n,m,k=cin()
A=cin()
A=[i-1 for i in A]
B=[list([]) for i in range(n)]
C=[False for i in range(n)]
ans=m... | output | 1 | 52,697 | 13 | 105,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,698 | 13 | 105,396 |
Tags: dfs and similar, graphs
Correct Solution:
```
n, m, k = map(int, input().split())
capitals = list(map(int, input().split()))
graph = dict([(key, []) for key in range(1, n + 1)])
graph_country = dict([(key, 0) for key in range(1, n + 1)])
roads = []
for i in range(m):
u, v = map(int, input().split())
roads... | output | 1 | 52,698 | 13 | 105,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,699 | 13 | 105,398 |
Tags: dfs and similar, graphs
Correct Solution:
```
V, E, K = map(int, input().split())
C = set(map(int, input().split()))
C = set(map(lambda x: x - 1, C))
g = [[] for i in range(V)]
for i in range(E):
u, v = map(int, input().split())
u, v = u - 1, v - 1
g[u].append(v)
g[v].append(u)
components = list(... | output | 1 | 52,699 | 13 | 105,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,700 | 13 | 105,400 |
Tags: dfs and similar, graphs
Correct Solution:
```
#!/usr/bin/env python3
from sys import *
from collections import *
def ri():
return map(int, input().split())
cnt = 0
def bfs(cc, i):
global cnt
v[cc] = 1
cnt += 1
g[i].append(cc)
d = deque()
d.append(cc)
while d:
a = d.pople... | output | 1 | 52,700 | 13 | 105,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,701 | 13 | 105,402 |
Tags: dfs and similar, graphs
Correct Solution:
```
from collections import deque
n,m,k = map(int,input().split())
line = input().split()
gov = []
for i in range(k):
gov.append(int(line[i])-1)
graph = {}
for i in range(m):
u,v = map(int,input().split())
u -= 1
v -= 1
if u not in graph:
graph... | output | 1 | 52,701 | 13 | 105,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to t... | instruction | 0 | 52,702 | 13 | 105,404 |
Tags: dfs and similar, graphs
Correct Solution:
```
import sys
import math
import collections
import heapq
import decimal
input=sys.stdin.readline
n,m,k=(int(i) for i in input().split())
l=[int(i) for i in input().split()]
d={}
for i in range(n):
d[i]=[]
for i in range(m):
a,b=(int(i) for i in input().split())
... | output | 1 | 52,702 | 13 | 105,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,703 | 13 | 105,406 |
Yes | output | 1 | 52,703 | 13 | 105,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,704 | 13 | 105,408 |
Yes | output | 1 | 52,704 | 13 | 105,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,705 | 13 | 105,410 |
Yes | output | 1 | 52,705 | 13 | 105,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,706 | 13 | 105,412 |
Yes | output | 1 | 52,706 | 13 | 105,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,707 | 13 | 105,414 |
No | output | 1 | 52,707 | 13 | 105,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,708 | 13 | 105,416 |
No | output | 1 | 52,708 | 13 | 105,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,709 | 13 | 105,418 |
No | output | 1 | 52,709 | 13 | 105,419 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n ... | instruction | 0 | 52,710 | 13 | 105,420 |
No | output | 1 | 52,710 | 13 | 105,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,723 | 13 | 105,446 |
Tags: bitmasks, trees
Correct Solution:
```
from math import log
n, q = [int(i) for i in input().split()]
maxlvl = int(log(n + 1, 2)) + 1
steps = [2 ** i for i in range(maxlvl)]
def calc_lvl(m):
for lvl in range(1, maxlvl):
if (m - steps[lvl-1]) % steps[lvl] == 0:
return (lvl, ((m - steps[lvl-1... | output | 1 | 52,723 | 13 | 105,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,724 | 13 | 105,448 |
Tags: bitmasks, trees
Correct Solution:
```
from math import *
n, q = list(map(int, input().split()))
depth = int(log2(n + 1))
def get_layer(u):
for layer in range(depth):
if u % (2 ** (layer + 1)) == 2 ** layer:
return layer
for x in range(q):
u = int(input())
layer = get_layer(u)
... | output | 1 | 52,724 | 13 | 105,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,725 | 13 | 105,450 |
Tags: bitmasks, trees
Correct Solution:
```
def maxx(n):
return n&-n
n,q=map(int,input().split())
root=n//2+1
while q>0:
x=int(input())
s=input()
for i in s:
if i=='U' and x!=root:
p=x+maxx(x)
if x==p-maxx(p)//2:
x=p
else:
x=x-maxx(x)
elif i=='L':
x=x-maxx(x)//2
elif i=='R':
x=x+maxx(x... | output | 1 | 52,725 | 13 | 105,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,726 | 13 | 105,452 |
Tags: bitmasks, trees
Correct Solution:
```
from math import log
n, q = [int(i) for i in input().split()]
maxlvl = int(log(n + 1, 2)) + 1
pows = [2 ** i for i in range(maxlvl)]
def calc_lvl(m):
for lvl in range(1, maxlvl):
if (m - pows[lvl-1]) % pows[lvl] == 0:
return (lvl, ((m - pows[lvl-1]) %... | output | 1 | 52,726 | 13 | 105,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,727 | 13 | 105,454 |
Tags: bitmasks, trees
Correct Solution:
```
from sys import stdin, stdout
#Number - номер текущей вершины
#cnt - кол-во вершин в детях
#up - вершина предок
#aim - вершина до которой мы хотим дойти
def find(number, aim, cnt, up):
if (aim == number):
if cnt:
return (number - cnt // 4 - 1, numb... | output | 1 | 52,727 | 13 | 105,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,728 | 13 | 105,456 |
Tags: bitmasks, trees
Correct Solution:
```
n, q = map(int,input().split())
par = n // 2 + 1
par = len(list(bin(par)[2:]))
for i in range(q):
ui = int(input())
si = input()
temp = bin(ui)[2:]
now = len(temp)
num = list((par - now) * "0" + temp)
now = par - now
for i in range(len(num)):
... | output | 1 | 52,728 | 13 | 105,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,729 | 13 | 105,458 |
Tags: bitmasks, trees
Correct Solution:
```
def greatest_pow2_divisor(x):
pow2 = 1
while x % pow2 == 0:
pow2 *= 2
return pow2 // 2
def parent(x):
pow2 = greatest_pow2_divisor(x)
if ((x + pow2) // (pow2 * 2)) % 2 == 1:
return x + pow2
return x - pow2
def left(x):
if x % 2 == 1:... | output | 1 | 52,729 | 13 | 105,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary t... | instruction | 0 | 52,730 | 13 | 105,460 |
Tags: bitmasks, trees
Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split(... | output | 1 | 52,730 | 13 | 105,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly t... | instruction | 0 | 52,731 | 13 | 105,462 |
Yes | output | 1 | 52,731 | 13 | 105,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly t... | instruction | 0 | 52,732 | 13 | 105,464 |
Yes | output | 1 | 52,732 | 13 | 105,465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.