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 a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,141
13
200,282
"Correct Solution: ``` from collections import deque import sys readline = sys.stdin.readline N, M = map(int, readline().split()) G = [[] for i in range(N)] for i in range(M): a, b = map(int, readline().split()) a -= 1; b -= 1 G[a].append(b) G[b].append(a) def check(s, t): u = [0]*N u[s] = u[t]...
output
1
100,141
13
200,283
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,142
13
200,284
"Correct Solution: ``` import sys,heapq from collections import deque,defaultdict printn = lambda x: sys.stdout.write(x) inn = lambda : int(input()) inl = lambda: list(map(int, input().split())) inm = lambda: map(int, input().split()) DBG = True and False def ddprint(x): if DBG: print(x) n,m = inm() ds...
output
1
100,142
13
200,285
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,143
13
200,286
"Correct Solution: ``` import sys input=sys.stdin.readline sys.setrecursionlimit(10**7) N,M=map(int,input().split()) edge=[[] for i in range(N)] for i in range(M): a,b=map(int,input().split()) edge[a-1].append(b-1) edge[b-1].append(a-1) odd=0 f=0 s=0 v=[] for i in range(N): if len(edge[i])%2==1: ...
output
1
100,143
13
200,287
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,144
13
200,288
"Correct Solution: ``` N, M = map(int, input().split()) a, b = zip(*(map(int, input().split()) for _ in range(M))) G = [set() for _ in range(N + 1)] for x, y in zip(a, b): G[x].add(y) G[y].add(x) # 次数4の頂点間のパスの数が4でないならばTrueを返す def f(): x, y = (i for i in range(1, N + 1) if len(G[i]) == 4) q = [] ...
output
1
100,144
13
200,289
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,145
13
200,290
"Correct Solution: ``` N, M = map(int, input().split()) c = 0 d = 0 for _ in range(min(M, 1000)): a, b = map(int, input().split()) d += a * 5 + b * 7 c += a * 2 + b * 3 d %= 100 c %= 100 if c * 100 + d in [15, 238, 639, 1008, 1870, 2773, 3072, 3622, 4911, 4939, 5062, 5915, 6158, 6669, 7997, 8237, 82...
output
1
100,145
13
200,291
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,146
13
200,292
"Correct Solution: ``` import sys input = sys.stdin.readline N,M=map(int,input().split()) EDGE=[tuple(map(int,input().split())) for i in range(M)] E=[[] for i in range(N+1)] J=[0]*(N+1) for x,y in EDGE: J[x]+=1 J[y]+=1 E[x].append(y) E[y].append(x) from collections import deque Q=deque() Q.append(1...
output
1
100,146
13
200,293
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,147
13
200,294
"Correct Solution: ``` # -*- coding: utf-8 -*- def solve(): N, M = map(int, input().split()) F = [list() for _ in range(N+1)] D = [int() for _ in range(N+1)] for _ in range(M): a, b = map(int, input().split()) D[a] += 1 D[b] += 1 F[a].append(b) F[b].append(a) ...
output
1
100,147
13
200,295
Provide a correct Python 3 solution for this coding contest problem. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes)...
instruction
0
100,148
13
200,296
"Correct Solution: ``` import sys sys.setrecursionlimit(100000) N, M = map(int, input().split()) count = [0] * (N) E = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) E[a - 1].append(b - 1) E[b - 1].append(a - 1) count[a - 1] += 1 count[b - 1] += 1 count_sum = 0 count4...
output
1
100,148
13
200,297
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,149
13
200,298
Yes
output
1
100,149
13
200,299
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,150
13
200,300
Yes
output
1
100,150
13
200,301
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,151
13
200,302
Yes
output
1
100,151
13
200,303
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,152
13
200,304
Yes
output
1
100,152
13
200,305
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,153
13
200,306
No
output
1
100,153
13
200,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,154
13
200,308
No
output
1
100,154
13
200,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,155
13
200,310
No
output
1
100,155
13
200,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i b...
instruction
0
100,156
13
200,312
No
output
1
100,156
13
200,313
Provide tags and a correct Python 3 solution for this coding contest problem. A never-ending, fast-changing and dream-like world unfolds, as the secret door opens. A world is an unordered graph G, in whose vertex set V(G) there are two special vertices s(G) and t(G). An initial world has vertex set {s(G), t(G)} and a...
instruction
0
100,853
13
201,706
Tags: combinatorics, dp, flows, graphs Correct Solution: ``` mod = int(1e9 + 7) n, m = map(int, input().split()) f = [ [0 for i in range(60)] for j in range(60) ] g = [ [0 for i in range(60)] for j in range(60) ] s = [ [0 for i in range(60)] for j in range(60) ] inv = [ 1 ] f[0][0] = s[0][0] = 1 def pow(x, exp) : ...
output
1
100,853
13
201,707
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,163
13
202,326
"Correct Solution: ``` import sys sys.setrecursionlimit(10**8) n=int(input()) inp=[list(map(int,input().split())) for i in range(n)] inp.sort(key=lambda tup:tup[0]) data=[[-1]*3 for i in range(n)] D=[-1]*n for e in inp: for i in range(2,len(e)): data[e[i]][0]=e[0] if i==2: data[e[0]][1]...
output
1
101,163
13
202,327
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,164
13
202,328
"Correct Solution: ``` import sys TYPE_ROOT = 0 TYPE_NODE = 1 TYPE_LEAF = 2 class Node: def __init__(self, id): self.id = id self.parent = None self.children = [] self.type = None self.depth = 0 def set_depth(node, depth): node.depth = depth for child in node.chi...
output
1
101,164
13
202,329
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,165
13
202,330
"Correct Solution: ``` import sys sys.setrecursionlimit(10**7) nodedict = {} class Node: def __init__(self, id, jisu, children): self.id = id self.jisu = jisu self.children = children self.parent = -1 self.depth = -1 def __repr__(self): return "id:{}, jisu:{}, ...
output
1
101,165
13
202,331
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,166
13
202,332
"Correct Solution: ``` import sys sys.setrecursionlimit(2**20) class Node: def __init__(self, parent, left, right): self.parent = parent self.left = left self.right = right d = {} # {id: depth} def get_all_depth(t, u, p): # (Tree, id, depth) d[u] = p if t[u].right is not None: ...
output
1
101,166
13
202,333
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,167
13
202,334
"Correct Solution: ``` def rootedtrees(): def set_depth(node_id): if tree[node_id]['parent'] == -1: return 0 else: return set_depth(tree[node_id]['parent']) + 1 n = int(input()) tree = [{'parent': -1, 'depth': 0, 'node_type': 'leaf', 'children': []} for ...
output
1
101,167
13
202,335
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,168
13
202,336
"Correct Solution: ``` n = int(input()) depths = [0] * n parents = [-1] * n nodes = [0] * n children = [0] * n childs = [] parts = ['leaf'] * n numall = [] for i in range(n): numall.append(list(map(int, input().split()))) numall.sort() for i in range(n): nums = numall[i] nodes[i] = int(nums[0]) ch...
output
1
101,168
13
202,337
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,169
13
202,338
"Correct Solution: ``` n = int(input()) root = {} children = [0] * n for i in range(n): id, k, *c = list(map(int, input().split())) for j in c: root[j] = id children[id] = c for i in range(n): print('node {}: parent = '.format(str(i)), end='') p = [i] while True: try: p.append(root[p[-1]]) ...
output
1
101,169
13
202,339
Provide a correct Python 3 solution for this coding contest problem. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <image> Fig. 1 A free tree is a connnected, acyclic, und...
instruction
0
101,170
13
202,340
"Correct Solution: ``` class Node(): def __init__(self, value, parent=None): self.value = value self.parent = parent self.left_child = None self.right_sibling = None def set_left_child(self, child): self.left_child = child def set_right_sibling(self, sibling): ...
output
1
101,170
13
202,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,171
13
202,342
Yes
output
1
101,171
13
202,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,172
13
202,344
Yes
output
1
101,172
13
202,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,173
13
202,346
Yes
output
1
101,173
13
202,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,174
13
202,348
Yes
output
1
101,174
13
202,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,175
13
202,350
No
output
1
101,175
13
202,351
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,176
13
202,352
No
output
1
101,176
13
202,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,177
13
202,354
No
output
1
101,177
13
202,355
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). <...
instruction
0
101,178
13
202,356
No
output
1
101,178
13
202,357
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,270
13
202,540
Tags: dfs and similar, dp, trees Correct Solution: ``` from sys import stdin si = iter(stdin) num = int(next(si)) nodeedge = [[] for _ in range(num + 1)] nodescore = [0] * (num + 1) nodecount = [0] * (num + 1) for _ in range(num-1): u,v = map(int, next(si).split()) nodeedge[u].append(v) nodeedge[v].append(...
output
1
101,270
13
202,541
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,271
13
202,542
Tags: dfs and similar, dp, trees Correct Solution: ``` import sys from collections import deque input = sys.stdin.readline n=int(input()) E=[[] for i in range(n+1)] for i in range(n-1): x,y=map(int,input().split()) E[x].append(y) E[y].append(x) H=[-1]*(n+1) H[1]=0 QUE=deque([1]) fromnode=[-1]*(n+1) wh...
output
1
101,271
13
202,543
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,272
13
202,544
Tags: dfs and similar, dp, trees Correct Solution: ``` import sys input = sys.stdin.readline n = int(input()) ab = [list(map(int,input().split())) for i in range(n-1)] graph = [[] for i in range(n+1)] deg = [0]*(n+1) for a,b in ab: graph[a].append(b) graph[b].append(a) deg[a] += 1 deg[b] += 1 if n == 2: print...
output
1
101,272
13
202,545
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,273
13
202,546
Tags: dfs and similar, dp, trees Correct Solution: ``` ###pyrival template for fast IO import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.wri...
output
1
101,273
13
202,547
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,274
13
202,548
Tags: dfs and similar, dp, trees Correct Solution: ``` import sys from collections import deque from random import randrange input = sys.stdin.readline print = sys.stdout.write from types import GeneratorType def bootstrap(f, stack=[]): def wrappedfunc(*args, **kwargs): if stack: return f(*arg...
output
1
101,274
13
202,549
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,275
13
202,550
Tags: dfs and similar, dp, trees Correct Solution: ``` class Graph: def __init__(self, n_vertices, edges, directed=True): self.n_vertices = n_vertices self.edges = edges self.directed = directed @property def adj(self): try: return self._adj except Attr...
output
1
101,275
13
202,551
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,276
13
202,552
Tags: dfs and similar, dp, trees Correct Solution: ``` import sys def getpar(Edge, p): N = len(Edge) par = [0]*N par[0] = -1 par[p] -1 stack = [p] visited = set([p]) while stack: vn = stack.pop() for vf in Edge[vn]: if vf in visited: cont...
output
1
101,276
13
202,553
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on ea...
instruction
0
101,277
13
202,554
Tags: dfs and similar, dp, trees Correct Solution: ``` import sys import threading input = sys.stdin.readline sys.setrecursionlimit(10**7) N = int(input()) graph = [[] for _ in range(N)] for _ in range(N-1): a, b = map(int, input().split()) graph[a-1].append(b-1) graph[b-1].append(a-1) dp = [1]*N checked...
output
1
101,277
13
202,555
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,278
13
202,556
Yes
output
1
101,278
13
202,557
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,279
13
202,558
Yes
output
1
101,279
13
202,559
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,280
13
202,560
Yes
output
1
101,280
13
202,561
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,281
13
202,562
Yes
output
1
101,281
13
202,563
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,282
13
202,564
No
output
1
101,282
13
202,565
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,283
13
202,566
No
output
1
101,283
13
202,567
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,284
13
202,568
No
output
1
101,284
13
202,569
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 (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree. Initially all vertices are white. On the first turn of the game you c...
instruction
0
101,285
13
202,570
No
output
1
101,285
13
202,571
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n integer numbers a_1, a_2, ..., a_n. Consider graph on n nodes, in which nodes i, j (i≠ j) are connected if and only if, a_i AND a_j≠ 0, where AND denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_opera...
instruction
0
101,286
13
202,572
Tags: bitmasks, brute force, graphs, shortest paths Correct Solution: ``` #!/usr/bin/python3 import math import sys DEBUG = False def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=' ', end='\n'): if DEBUG: print(*value, sep=sep, end=end) INF = 70 def solve(N, A): B = ...
output
1
101,286
13
202,573