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.
You are given an undirected graph consisting of n vertices and m edges. Initially there is a single integer written on every vertex: the vertex i has p_i written on it. All p_i are distinct inte... | instruction | 0 | 58,218 | 13 | 116,436 |
No | output | 1 | 58,218 | 13 | 116,437 |
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 consisting of n vertices and m edges. Initially there is a single integer written on every vertex: the vertex i has p_i written on it. All p_i are distinct inte... | instruction | 0 | 58,219 | 13 | 116,438 |
No | output | 1 | 58,219 | 13 | 116,439 |
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 consisting of n vertices and m edges. Initially there is a single integer written on every vertex: the vertex i has p_i written on it. All p_i are distinct inte... | instruction | 0 | 58,220 | 13 | 116,440 |
No | output | 1 | 58,220 | 13 | 116,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected complete graph with n nodes, where some edges are pr... | instruction | 0 | 58,269 | 13 | 116,538 |
Tags: bitmasks, brute force, data structures, dfs and similar, dsu, graphs, greedy, trees
Correct Solution:
```
import sys
from sys import stdin
from collections import deque
def uf_find(n,p):
ufl = []
while p[n] != n:
ufl.append(n)
n = p[n]
for i in ufl:
p[i] = n
return n
... | output | 1 | 58,269 | 13 | 116,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected complete graph with n nodes, where some edges are pr... | instruction | 0 | 58,270 | 13 | 116,540 |
Tags: bitmasks, brute force, data structures, dfs and similar, dsu, graphs, greedy, trees
Correct Solution:
```
def divisors(M):
d=[]
i=1
while M>=i**2:
if M%i==0:
d.append(i)
if i**2!=M:
d.append(M//i)
i=i+1
return d
def popcount(x):
x = x - ... | output | 1 | 58,270 | 13 | 116,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected complete graph with n nodes, where some edges are pr... | instruction | 0 | 58,271 | 13 | 116,542 |
Tags: bitmasks, brute force, data structures, dfs and similar, dsu, graphs, greedy, trees
Correct Solution:
```
import sys, os
if os.environ['USERNAME']=='kissz':
inp=open('in3.txt','r').readline
def debug(*args):
print(*args,file=sys.stderr)
else:
inp=sys.stdin.readline
def debug(*args):
... | output | 1 | 58,271 | 13 | 116,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected compl... | instruction | 0 | 58,272 | 13 | 116,544 |
No | output | 1 | 58,272 | 13 | 116,545 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected compl... | instruction | 0 | 58,273 | 13 | 116,546 |
No | output | 1 | 58,273 | 13 | 116,547 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected compl... | instruction | 0 | 58,274 | 13 | 116,548 |
No | output | 1 | 58,274 | 13 | 116,549 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected compl... | instruction | 0 | 58,275 | 13 | 116,550 |
No | output | 1 | 58,275 | 13 | 116,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,276 | 13 | 116,552 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
res = []
n = int(input())
print('?', 1, flush=True)
arr = list(map(int, input().split()))
for v,d in enumerate(arr):
if d==1:
res.append([0,v])
one = [v for v,d in enumerate(arr) if d&1]
two = [v for v,d in enumerate(arr) if v and not (... | output | 1 | 58,276 | 13 | 116,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,277 | 13 | 116,554 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
flush = sys.stdout.flush
def query(x):
print('?', x)
flush()
return list(map(int, input().split()))
n = int(input())
ans = set()
A = query(1)
X, Y = [], []
for i, a in enumerate(A, 1):
if not ... | output | 1 | 58,277 | 13 | 116,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,278 | 13 | 116,556 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
import sys
import math
#def get_ints():
# return map(int, sys.stdin.readline().strip().split())
def inpu():
return sys.stdin.readline()
#lets = 'abcdefghijklmnopqrstuvwxyz'
#letts = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
#key = {lets[i]:i for i in ran... | output | 1 | 58,278 | 13 | 116,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,279 | 13 | 116,558 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
import os, sys
from io import BytesIO, IOBase
from math import log2, ceil, sqrt, gcd
from _collections import deque
import heapq as hp
from bisect import bisect_left, bisect_right
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __... | output | 1 | 58,279 | 13 | 116,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,280 | 13 | 116,560 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
def readline():
return map(int, input().split())
def ask(r):
assert r >= 0
print('?', r + 1)
return list(readline())
def say(edges):
print('!')
for (a, b) in edges:
print(a+1, b+1)
def main():
n = int(input... | output | 1 | 58,280 | 13 | 116,561 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,281 | 13 | 116,562 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
def query(node):
print("?", node+1)
return list(map(int, input().split()))
n = int(input())
ans = query(0) # root at node 0
max_depth = max(ans)
depths = [set() for _ in range(max_depth+1)]
for node, depth in enumerate(ans):
depths[... | output | 1 | 58,281 | 13 | 116,563 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,282 | 13 | 116,564 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
from collections import Counter
import string
import math
import bisect
#import random
import sys
# sys.setrecursionlimit(10**6)
from fractions import Fraction
def array_int():
return [int(i) for i in sys.stdin.readline().split()]
def vary(arr... | output | 1 | 58,282 | 13 | 116,565 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ... | instruction | 0 | 58,283 | 13 | 116,566 |
Tags: constructive algorithms, interactive, trees
Correct Solution:
```
import sys
from collections import deque
def get(i):
print("?", i+1)
return list(map(int, input().split()))
n = int(input())
e = set()
c = 0
z = get(0)
odd = 0
even = 0
for i, x in enumerate(z):
if x == 0:
continue
if x & 1:... | output | 1 | 58,283 | 13 | 116,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,284 | 13 | 116,568 |
Yes | output | 1 | 58,284 | 13 | 116,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,285 | 13 | 116,570 |
Yes | output | 1 | 58,285 | 13 | 116,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,286 | 13 | 116,572 |
Yes | output | 1 | 58,286 | 13 | 116,573 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,287 | 13 | 116,574 |
Yes | output | 1 | 58,287 | 13 | 116,575 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,288 | 13 | 116,576 |
No | output | 1 | 58,288 | 13 | 116,577 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,289 | 13 | 116,578 |
No | output | 1 | 58,289 | 13 | 116,579 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,290 | 13 | 116,580 |
No | output | 1 | 58,290 | 13 | 116,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered fr... | instruction | 0 | 58,291 | 13 | 116,582 |
No | output | 1 | 58,291 | 13 | 116,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. T... | instruction | 0 | 58,581 | 13 | 117,162 |
Tags: constructive algorithms, data structures, dfs and similar, dp, graphs
Correct Solution:
```
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
import heapq
INF=10**9
def Dijkstra(graph, start,m):
dist=[INF]*len(graph)
parent=[INF]*len(graph)
queue=[(0, start)]
while queue:
... | output | 1 | 58,581 | 13 | 117,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. T... | instruction | 0 | 58,582 | 13 | 117,164 |
Tags: constructive algorithms, data structures, dfs and similar, dp, graphs
Correct Solution:
```
# https://codeforces.com/problemset/problem/840/B
# TLE
import sys
input=sys.stdin.readline
n, m = map(int, input().split())
d = list(map(int, input().split()))
g={}
def push(g, u, v, i):
if u not in g:
... | output | 1 | 58,582 | 13 | 117,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. T... | instruction | 0 | 58,583 | 13 | 117,166 |
Tags: constructive algorithms, data structures, dfs and similar, dp, graphs
Correct Solution:
```
import sys
n, m = map(int, sys.stdin.readline().split())
d = list(map(int, sys.stdin.readline().split()))
gph = [[] for _ in range(n)]
for _ in range(m):
u, v = map(int, sys.stdin.readline().split())
u -= 1
v... | output | 1 | 58,583 | 13 | 117,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an in... | instruction | 0 | 58,584 | 13 | 117,168 |
No | output | 1 | 58,584 | 13 | 117,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an in... | instruction | 0 | 58,585 | 13 | 117,170 |
No | output | 1 | 58,585 | 13 | 117,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an in... | instruction | 0 | 58,586 | 13 | 117,172 |
No | output | 1 | 58,586 | 13 | 117,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an in... | instruction | 0 | 58,587 | 13 | 117,174 |
No | output | 1 | 58,587 | 13 | 117,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N, and the edges are numbered 1, 2, ..., M. Edge i points from Vertex a_i to Vertex b_i.
For eac... | instruction | 0 | 58,731 | 13 | 117,462 |
No | output | 1 | 58,731 | 13 | 117,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N, and the edges are numbered 1, 2, ..., M. Edge i points from Vertex a_i to Vertex b_i.
For eac... | instruction | 0 | 58,732 | 13 | 117,464 |
No | output | 1 | 58,732 | 13 | 117,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N, and the edges are numbered 1, 2, ..., M. Edge i points from Vertex a_i to Vertex b_i.
For eac... | instruction | 0 | 58,733 | 13 | 117,466 |
No | output | 1 | 58,733 | 13 | 117,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N, and the edges are numbered 1, 2, ..., M. Edge i points from Vertex a_i to Vertex b_i.
For eac... | instruction | 0 | 58,734 | 13 | 117,468 |
No | output | 1 | 58,734 | 13 | 117,469 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,812 | 13 | 117,624 |
"Correct Solution:
```
def main():
INF = float('inf')
V, E = map(int, input().split())
G = [[INF for i in range(V)] for j in range(V)]
for i in range(V): G[i][i] = 0
for i in range(E):
s, t = map(int, input().split())
G[s][t] = -1
for k in range(V):
... | output | 1 | 58,812 | 13 | 117,625 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,813 | 13 | 117,626 |
"Correct Solution:
```
nv,ne = [int(i) for i in input().split()]
g = [[] for i in range(nv)]
for i in range(ne):
s,t = [int(j) for j in input().split()]
g[s].append(t)
visited = []
f = 0
def pursue_from(index, origin):
if visited[index]:
return
visited[index] = True
for next_index in... | output | 1 | 58,813 | 13 | 117,627 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,814 | 13 | 117,628 |
"Correct Solution:
```
import sys;
v,e=map(int, input().split());
v_l=[0]*v;
e_b=[0]*e;
e_l=[0]*e;
result=0;
for i in range(v):
v_l[i] = 0;
for i in range(e):
e_b[i], e_l[i] = map(int, input().split());
def DFS(u):
global result
global v_l
v_l[u] = 1
for i in range(e):
if(e_b[i] == u... | output | 1 | 58,814 | 13 | 117,629 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,815 | 13 | 117,630 |
"Correct Solution:
```
def is_contain_cycle(g, v):
visited = set()
for i in range(v):
if i in visited:
continue
#route = Stack([None])
route = [None]
dfs_stack = [(i, None)]
while dfs_stack:
u, prev = dfs_stack.pop()
while route[-1] != ... | output | 1 | 58,815 | 13 | 117,631 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,816 | 13 | 117,632 |
"Correct Solution:
```
def solve(V, E, G):
done = [False] * V
def dfs(i, path):
path.add(i)
for j in G[i]:
if j in path:
return True
if not done[j] and dfs(j, path):
return True
path.remove(i)
done[i] = True
return F... | output | 1 | 58,816 | 13 | 117,633 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,817 | 13 | 117,634 |
"Correct Solution:
```
def main():
v,e = map(int,input().split())
E = [[] for _ in range(v)]
for _ in range(e):
s,t = map(int,input().split())
E[s].append(t)
res = False
visited = [False]*v
checked = [False]*v
def dfs(u):
if visited[u]:
nonlocal res
... | output | 1 | 58,817 | 13 | 117,635 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,818 | 13 | 117,636 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(200000)
def dfs(root: int, add_duplicated=True) -> bool:
global edges, visited, duplicated
def body(i: int) -> bool:
visited[i] = True
for edge in edges[i]:
if visited[edge]:
if edge == root:
... | output | 1 | 58,818 | 13 | 117,637 |
Provide a correct Python 3 solution for this coding contest problem.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number ... | instruction | 0 | 58,819 | 13 | 117,638 |
"Correct Solution:
```
#Detectando Ciclos en un grafo
#Se puede mejorar a un mas
from collections import deque
import sys
def dfs(G,u):
n = len(G)
vis=[-1]*n
stackV = []
pila = deque()
pila.append(u)
vis[u]=1
stackV.append(u)
while(pila):
w = pila.pop()
for v in G[w]:
... | output | 1 | 58,819 | 13 | 117,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|... | instruction | 0 | 58,820 | 13 | 117,640 |
Yes | output | 1 | 58,820 | 13 | 117,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|... | instruction | 0 | 58,821 | 13 | 117,642 |
Yes | output | 1 | 58,821 | 13 | 117,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|... | instruction | 0 | 58,822 | 13 | 117,644 |
Yes | output | 1 | 58,822 | 13 | 117,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|... | instruction | 0 | 58,823 | 13 | 117,646 |
Yes | output | 1 | 58,823 | 13 | 117,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|... | instruction | 0 | 58,824 | 13 | 117,648 |
No | output | 1 | 58,824 | 13 | 117,649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.