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 a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,738 | 13 | 99,476 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = [[] for i in range(n)]
for i in range(n - 1):
v, u = map(int, input().split())
v -= 1
u -= 1
g[v].append(u)
g[u].append(v)
dp = [[] for i in range(n)]
d = [1 for i... | output | 1 | 49,738 | 13 | 99,477 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,739 | 13 | 99,478 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x]... | output | 1 | 49,739 | 13 | 99,479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,740 | 13 | 99,480 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
from sys import setrecursionlimit as SRL, stdin
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())
fa = [i for i in range(200005)]
s = [1] * 200005
def find(x):
t = []
while fa[x] != x:
t.append(x... | output | 1 | 49,740 | 13 | 99,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,741 | 13 | 99,482 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
N, M = map(int, readline().split())
E = []
for i in range(N-1):
u, v, w = map(int, readline().split())
E.append((w, u-1, v-1))
E... | output | 1 | 49,741 | 13 | 99,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,742 | 13 | 99,484 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
import typing
from bisect import bisect_right, bisect_left
import sys
def input():
return sys.stdin.readline().rstrip()
class DSU:
'''
Implement (union by size) + (path halving)
Reference:
Zvi Galil and Giuseppe F. Ita... | output | 1 | 49,742 | 13 | 99,485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m queries. The i-th query is given as an integer q_... | instruction | 0 | 49,743 | 13 | 99,486 |
Tags: divide and conquer, dsu, graphs, sortings, trees
Correct Solution:
```
n,m=map(int,input().split())
dp=[]
for i in range(n-1):
u,v,w=map(int,input().split())
dp.append((w,u-1,v-1))
dp=sorted(dp)
q=[int(x) for x in input().split()]
pos=[]
for i in range(m):
pos.append(i)
Q=sorted(zip(q,pos))
par=[]... | output | 1 | 49,743 | 13 | 99,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,744 | 13 | 99,488 |
Yes | output | 1 | 49,744 | 13 | 99,489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,745 | 13 | 99,490 |
Yes | output | 1 | 49,745 | 13 | 99,491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,746 | 13 | 99,492 |
Yes | output | 1 | 49,746 | 13 | 99,493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,747 | 13 | 99,494 |
Yes | output | 1 | 49,747 | 13 | 99,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,748 | 13 | 99,496 |
No | output | 1 | 49,748 | 13 | 99,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,749 | 13 | 99,498 |
No | output | 1 | 49,749 | 13 | 99,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,750 | 13 | 99,500 |
No | output | 1 | 49,750 | 13 | 99,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighted tree consisting of n vertices. Recall that a tree is a connected graph without cycles. Vertices u_i and v_i are connected by an edge with weight w_i.
You are given m qu... | instruction | 0 | 49,751 | 13 | 99,502 |
No | output | 1 | 49,751 | 13 | 99,503 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Guy-Manuel and Thomas are planning 144 trips around the world.
You are given a simple weighted undirected connected graph with n vertexes and m edges with the following restriction: there isn't... | instruction | 0 | 49,800 | 13 | 99,600 |
No | output | 1 | 49,800 | 13 | 99,601 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Guy-Manuel and Thomas are planning 144 trips around the world.
You are given a simple weighted undirected connected graph with n vertexes and m edges with the following restriction: there isn't... | instruction | 0 | 49,801 | 13 | 99,602 |
No | output | 1 | 49,801 | 13 | 99,603 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from ... | instruction | 0 | 49,938 | 13 | 99,876 |
Tags: bitmasks, graph matchings, graphs
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
from collections import defaultdict
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buff... | output | 1 | 49,938 | 13 | 99,877 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from ... | instruction | 0 | 49,939 | 13 | 99,878 |
Tags: bitmasks, graph matchings, graphs
Correct Solution:
```
import math
N = 15
mat = 0
inf = 1000000000
answer = inf
def Get_Cycle_Length(v,graph):
global mat
global answer
if len(v) == 0: #por lo de conf 3
answer = min(answer,mat)
return
end = v.pop()
i = 0
while i<len... | output | 1 | 49,939 | 13 | 99,879 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from ... | instruction | 0 | 49,940 | 13 | 99,880 |
Tags: bitmasks, graph matchings, graphs
Correct Solution:
```
import math
N = 15
mat = 0
inf = 1000000000
answer = inf
def Get_Cycle_Length(v,graph):
global mat
global answer
if len(v) == 0:
answer = min(answer,mat)
return
end = v.pop()
i = 0
while i<len(v):
se = v.pop... | output | 1 | 49,940 | 13 | 99,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from ... | instruction | 0 | 49,941 | 13 | 99,882 |
Tags: bitmasks, graph matchings, graphs
Correct Solution:
```
import math
N = 15
mat = 0
inf = 1000000000
answer = inf
def Get_Cycle_Length(v,graph):
global mat
global answer
if len(v) == 0: #por lo de conf 3
answer = min(answer,mat)
return
end = v.pop()
i = 0
while i<len... | output | 1 | 49,941 | 13 | 99,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges be... | instruction | 0 | 49,942 | 13 | 99,884 |
No | output | 1 | 49,942 | 13 | 99,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges be... | instruction | 0 | 49,943 | 13 | 99,886 |
No | output | 1 | 49,943 | 13 | 99,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,078 | 13 | 100,156 |
Tags: constructive algorithms, graphs
Correct Solution:
```
n, m = [int(x) for x in input().split()]
connections = [[i != j for j in range(n)] for i in range(n)]
cnt = [0] * n
for _ in range(m):
u, v = [int(x) - 1 for x in input().split()]
connections[u][v] = connections[v][u] = False
cnt[u] += 1
cnt[v... | output | 1 | 50,078 | 13 | 100,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,079 | 13 | 100,158 |
Tags: constructive algorithms, graphs
Correct Solution:
```
n, m = map(int, input().split(' '))
G = [[0]*n for i in range(n)]
for i in range(m):
u, v = map(lambda x:int(x)-1, input().split(' '))
G[u][v] = G[v][u] = 1
s = [' ']*n
for i in range(n):
if G[i].count(1) == n-1:
s[i] = 'b'
try:
ano... | output | 1 | 50,079 | 13 | 100,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,080 | 13 | 100,160 |
Tags: constructive algorithms, graphs
Correct Solution:
```
import sys
n, m = map(int, input().split())
graph = [set([i]) for i in range(n)]
for i in range(m):
i, j = map(int, input().split())
graph[i - 1].add(j - 1)
graph[j - 1].add(i - 1)
thebs = set()
for i in range(n):
if len(graph[i]) == n:
... | output | 1 | 50,080 | 13 | 100,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,081 | 13 | 100,162 |
Tags: constructive algorithms, graphs
Correct Solution:
```
from pprint import pprint
def main():
n, m = map(int, input().split(" "))
adj = [[1] * n for _ in range(n)]
for i in range(n):
adj[i][i] = 0
for _ in range(m):
x, y = map(int, input().split(" "))
x -= 1
y -=... | output | 1 | 50,081 | 13 | 100,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,082 | 13 | 100,164 |
Tags: constructive algorithms, graphs
Correct Solution:
```
n,m = map(int,input().split())
g = [set() for i in range(n)]
for i in range(m):
a = tuple(map(int,input().split()))
g[a[0]-1].add(a[1]-1)
g[a[1]-1].add(a[0]-1)
res = ['']*n
good = 1
for i in range(n):
if len(g[i]) == n-1:
res[i] = 'b'
... | output | 1 | 50,082 | 13 | 100,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,083 | 13 | 100,166 |
Tags: constructive algorithms, graphs
Correct Solution:
```
from math import *
N, M = 510, 3 * 10 ** 5 + 10
g = [[] for _ in range(M)]
n , m = map(int, input().split())
mx = [[False] * N for _ in range(N + 1)]
for _ in range(m):
u, v = map(int, input().split())
mx[u][v] = mx[v][u] = True
all_eq = True
mark = [Fa... | output | 1 | 50,083 | 13 | 100,167 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,084 | 13 | 100,168 |
Tags: constructive algorithms, graphs
Correct Solution:
```
def dfs(v, graph, used, str_arr, color=0):
used[v] = True
str_arr[v] = color
for u in graph[v]:
if used[u] and str_arr[u] == color:
return False
if not used[u] and not dfs(u, graph, used, str_arr, color ^ 1):
... | output | 1 | 50,084 | 13 | 100,169 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G wi... | instruction | 0 | 50,085 | 13 | 100,170 |
Tags: constructive algorithms, graphs
Correct Solution:
```
from sys import stdin
n,m = [int(x) for x in stdin.readline().split()]
graph = [set([y for y in range(n)]) for x in range(n)]
graph2 = [set() for x in range(n)]
for x in range(n):
graph[x].remove(x)
for edge in range(m):
a,b = [int(x) for x in stdi... | output | 1 | 50,085 | 13 | 100,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,086 | 13 | 100,172 |
Yes | output | 1 | 50,086 | 13 | 100,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,087 | 13 | 100,174 |
Yes | output | 1 | 50,087 | 13 | 100,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,088 | 13 | 100,176 |
Yes | output | 1 | 50,088 | 13 | 100,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,089 | 13 | 100,178 |
Yes | output | 1 | 50,089 | 13 | 100,179 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,090 | 13 | 100,180 |
Yes | output | 1 | 50,090 | 13 | 100,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,091 | 13 | 100,182 |
No | output | 1 | 50,091 | 13 | 100,183 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,092 | 13 | 100,184 |
No | output | 1 | 50,092 | 13 | 100,185 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,093 | 13 | 100,186 |
No | output | 1 | 50,093 | 13 | 100,187 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to... | instruction | 0 | 50,094 | 13 | 100,188 |
No | output | 1 | 50,094 | 13 | 100,189 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,586 | 13 | 101,172 |
Tags: brute force, graphs
Correct Solution:
```
'''input
4 4
1 2
2 3
3 4
4 1
'''
from sys import stdin
from collections import defaultdict
from itertools import combinations
def change_graph(define):
temp = defaultdict(list)
for i in graph:
for node in graph[i]:
temp[define[i]].append(define[node])
return te... | output | 1 | 50,586 | 13 | 101,173 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,587 | 13 | 101,174 |
Tags: brute force, graphs
Correct Solution:
```
from itertools import product
n, m = map(int, input().split())
e = []
for i in range(m):
a, b = map(int, input().split())
e.append((a, b))
ans = 0
for idx in product([0], *[list(range(1, 7)) for i in range(n)]):
used = [[0] * 7 for i in range(7)]
cnt = 0
for u, v in... | output | 1 | 50,587 | 13 | 101,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,588 | 13 | 101,176 |
Tags: brute force, graphs
Correct Solution:
```
n,m=map(int,input().split())
d=[[] for i in range(n+1)]
for x in range(m):
a,b=map(int,input().split())
d[a].append(b)
d[b].append(a)
if n<7:
print(m)
else:
ans=-1
for i in range(1,n):
for j in range(i+1,n+1):
sub=0
... | output | 1 | 50,588 | 13 | 101,177 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,589 | 13 | 101,178 |
Tags: brute force, graphs
Correct Solution:
```
n, m = map(int, input().split())
a = [[*map(int, input().split())] for i in range(m)]
from itertools import combinations
s = []
ans = 0
def do():
global ans
if len(s) == n:
t = set()
for j in a:
y, z = s[j[0] - 1], s[j[1] - 1]
if y > z:
y, z = z, y
t.... | output | 1 | 50,589 | 13 | 101,179 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,590 | 13 | 101,180 |
Tags: brute force, graphs
Correct Solution:
```
n, m = [int(i) for i in input().split()]
data = []
for i in range(m):
data.append([int(j) - 1 for j in input().split()])
ans = 0
for i in range(6 ** n):
k = i
num = [0] * n
for j in range(n):
dig = k % 6
k //= 6
num[j] = di... | output | 1 | 50,590 | 13 | 101,181 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,591 | 13 | 101,182 |
Tags: brute force, graphs
Correct Solution:
```
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
Edges = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
def dfs(maxd, L, ans):
if len(L) == N:
dominos = [set() for _ in range(7)]
score = 0
for a, b in... | output | 1 | 50,591 | 13 | 101,183 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,592 | 13 | 101,184 |
Tags: brute force, graphs
Correct Solution:
```
n,m=map(int,input().split())
L=[]
for i in range(n+1):
h=[]
L.append(h)
arr=[]
for i in range(m):
u,v=map(int,input().split())
L[u].append(v)
L[v].append(u)
arr.append((u,v))
if(n<7):
print(m)
else:
ans=0
for i in range(1,8):
e... | output | 1 | 50,592 | 13 | 101,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly ... | instruction | 0 | 50,593 | 13 | 101,186 |
Tags: brute force, graphs
Correct Solution:
```
import logging
from collections import defaultdict
def calc_assigned_edge_nums(n, m, edges, new_comer):
d_v2n = {}
v = 1
for i in range(1, n + 1):
if i == new_comer:
d_v2n[i] = 7
else:
d_v2n[i] = v
v += 1
... | output | 1 | 50,593 | 13 | 101,187 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b do... | instruction | 0 | 50,594 | 13 | 101,188 |
Yes | output | 1 | 50,594 | 13 | 101,189 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b do... | instruction | 0 | 50,595 | 13 | 101,190 |
Yes | output | 1 | 50,595 | 13 | 101,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 β€ a β€ b β€ 6, there is exactly one domino with a dots on one half and b do... | instruction | 0 | 50,596 | 13 | 101,192 |
Yes | output | 1 | 50,596 | 13 | 101,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.