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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,480 | 13 | 142,960 |
Yes | output | 1 | 71,480 | 13 | 142,961 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,481 | 13 | 142,962 |
Yes | output | 1 | 71,481 | 13 | 142,963 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,482 | 13 | 142,964 |
Yes | output | 1 | 71,482 | 13 | 142,965 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,483 | 13 | 142,966 |
No | output | 1 | 71,483 | 13 | 142,967 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,484 | 13 | 142,968 |
No | output | 1 | 71,484 | 13 | 142,969 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,485 | 13 | 142,970 |
No | output | 1 | 71,485 | 13 | 142,971 |
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 G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loo... | instruction | 0 | 71,486 | 13 | 142,972 |
No | output | 1 | 71,486 | 13 | 142,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We will recursively define uninity of a tree, as follows: (Uni is a Japanese word for sea urchins.)
* A tree consisting of one vertex is a tree of uninity 0.
* Suppose there are zero or more tr... | instruction | 0 | 71,491 | 13 | 142,982 |
No | output | 1 | 71,491 | 13 | 142,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We will recursively define uninity of a tree, as follows: (Uni is a Japanese word for sea urchins.)
* A tree consisting of one vertex is a tree of uninity 0.
* Suppose there are zero or more tr... | instruction | 0 | 71,492 | 13 | 142,984 |
No | output | 1 | 71,492 | 13 | 142,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We will recursively define uninity of a tree, as follows: (Uni is a Japanese word for sea urchins.)
* A tree consisting of one vertex is a tree of uninity 0.
* Suppose there are zero or more tr... | instruction | 0 | 71,493 | 13 | 142,986 |
No | output | 1 | 71,493 | 13 | 142,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Takahashi was given the following problem from Aoki:
* You are given a tree with N vertices and an integer K. The vertices are numbered 1 through N. The edges are represented by pairs ... | instruction | 0 | 71,494 | 13 | 142,988 |
No | output | 1 | 71,494 | 13 | 142,989 |
Provide a correct Python 3 solution for this coding contest problem.
There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with c... | instruction | 0 | 71,576 | 13 | 143,152 |
"Correct Solution:
```
N = int(input())
A = [int(input()) for i in range(N)]
INF = 10**18
N2 = 2**N
def dfs(i, D):
if i == N:
return sum(D)
b = 1 << i
a = A[i]
def sel(j, state, u):
if j == N2:
D2 = D[:]
for e in u:
D2[e] -= 1
D2[e ... | output | 1 | 71,576 | 13 | 143,153 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighed undirected connected graph, consisting of n vertices and m edges.
You should answer q queries, the i-th query is to find the shortest distance between vertices u_i and v... | instruction | 0 | 71,656 | 13 | 143,312 |
No | output | 1 | 71,656 | 13 | 143,313 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighed undirected connected graph, consisting of n vertices and m edges.
You should answer q queries, the i-th query is to find the shortest distance between vertices u_i and v... | instruction | 0 | 71,657 | 13 | 143,314 |
No | output | 1 | 71,657 | 13 | 143,315 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighed undirected connected graph, consisting of n vertices and m edges.
You should answer q queries, the i-th query is to find the shortest distance between vertices u_i and v... | instruction | 0 | 71,658 | 13 | 143,316 |
No | output | 1 | 71,658 | 13 | 143,317 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a weighed undirected connected graph, consisting of n vertices and m edges.
You should answer q queries, the i-th query is to find the shortest distance between vertices u_i and v... | instruction | 0 | 71,659 | 13 | 143,318 |
No | output | 1 | 71,659 | 13 | 143,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,754 | 13 | 143,508 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
#!/usr/bin/env python3
from collections import deque
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
n, m = [int(item) for item in input().split()]
ans = 0
edge = set()
for i in range(m):
a, b = [int(item) - 1 for item in inpu... | output | 1 | 71,754 | 13 | 143,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,755 | 13 | 143,510 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
import sys
import math
from collections import defaultdict,Counter,deque
# input=sys.stdin.readline
# def print(x):
# sys.stdout.write(str(x)+"\n")
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlin... | output | 1 | 71,755 | 13 | 143,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,756 | 13 | 143,512 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, deque
from bisect import bisect_left
from itertools import product
input = stdin.buffer.readline
n, m = map(int, input().split())
e = [set() for _ in range(n+1)]
for _ in range(m):
a, b... | output | 1 | 71,756 | 13 | 143,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,757 | 13 | 143,514 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
# from sys import stdin
# def rl():
# return [int(w) for w in stdin.readline().split()]
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,in... | output | 1 | 71,757 | 13 | 143,515 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,758 | 13 | 143,516 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
E = [[] for _ in range(N+1)]
for _ in range(M):
v, u = map(int, input().split())
E[v].append(u)
E[u].append(v)
Open = [True] * (N+1)
Rem = set(range(1, N+1))
def bfs(v)... | output | 1 | 71,758 | 13 | 143,517 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,759 | 13 | 143,518 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
class UnionFind(object):
__slots__ = ['nodes']
def __init__(self, n: int):
self.nodes = [-1]*n
def size(self, x: int) -> int:
return -self.nodes[self.find(x)]
def find(self, x: int) -> int:
if self.nodes[x] < 0... | output | 1 | 71,759 | 13 | 143,519 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,760 | 13 | 143,520 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
from sys import stdin
def rl():
return [int(w) for w in stdin.readline().split()]
n,m = rl()
he = [set() for _ in range(n+1)]
for _ in range(m):
a,b = rl()
he[a].add(b)
he[b].add(a)
unvisited = set(range(1,n+1))
ccs = 0
while unvisited... | output | 1 | 71,760 | 13 | 143,521 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weigh... | instruction | 0 | 71,761 | 13 | 143,522 |
Tags: dfs and similar, dsu, graphs, sortings
Correct Solution:
```
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n,m = map(int, input().split())
G = [set() for i in range(n)]
for i in range(m):
a,b = map(int, input().split())
a,b = a-1,b-1
G[a].add(b)
G[b].add(a)
ans = 0
... | output | 1 | 71,761 | 13 | 143,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,762 | 13 | 143,524 |
Yes | output | 1 | 71,762 | 13 | 143,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,763 | 13 | 143,526 |
Yes | output | 1 | 71,763 | 13 | 143,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,764 | 13 | 143,528 |
Yes | output | 1 | 71,764 | 13 | 143,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,765 | 13 | 143,530 |
Yes | output | 1 | 71,765 | 13 | 143,531 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,766 | 13 | 143,532 |
No | output | 1 | 71,766 | 13 | 143,533 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,767 | 13 | 143,534 |
No | output | 1 | 71,767 | 13 | 143,535 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,768 | 13 | 143,536 |
No | output | 1 | 71,768 | 13 | 143,537 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a des... | instruction | 0 | 71,769 | 13 | 143,538 |
No | output | 1 | 71,769 | 13 | 143,539 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Donghyun's new social network service (SNS) contains n users numbered 1, 2, …, n. Internally, their network is a tree graph, so there are n-1 direct connections between each user. Each user can ... | instruction | 0 | 71,786 | 13 | 143,572 |
No | output | 1 | 71,786 | 13 | 143,573 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Donghyun's new social network service (SNS) contains n users numbered 1, 2, …, n. Internally, their network is a tree graph, so there are n-1 direct connections between each user. Each user can ... | instruction | 0 | 71,787 | 13 | 143,574 |
No | output | 1 | 71,787 | 13 | 143,575 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Donghyun's new social network service (SNS) contains n users numbered 1, 2, …, n. Internally, their network is a tree graph, so there are n-1 direct connections between each user. Each user can ... | instruction | 0 | 71,788 | 13 | 143,576 |
No | output | 1 | 71,788 | 13 | 143,577 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is now at home and his son has a simple task for him.
Given a rooted tree with n vertices, numbered from 1 to n (vertex 1 is the root). Each vertex of the tree has a value. You should ans... | instruction | 0 | 72,035 | 13 | 144,070 |
No | output | 1 | 72,035 | 13 | 144,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is now at home and his son has a simple task for him.
Given a rooted tree with n vertices, numbered from 1 to n (vertex 1 is the root). Each vertex of the tree has a value. You should ans... | instruction | 0 | 72,036 | 13 | 144,072 |
No | output | 1 | 72,036 | 13 | 144,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is now at home and his son has a simple task for him.
Given a rooted tree with n vertices, numbered from 1 to n (vertex 1 is the root). Each vertex of the tree has a value. You should ans... | instruction | 0 | 72,037 | 13 | 144,074 |
No | output | 1 | 72,037 | 13 | 144,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is now at home and his son has a simple task for him.
Given a rooted tree with n vertices, numbered from 1 to n (vertex 1 is the root). Each vertex of the tree has a value. You should ans... | instruction | 0 | 72,038 | 13 | 144,076 |
No | output | 1 | 72,038 | 13 | 144,077 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,463 | 13 | 144,926 |
"Correct Solution:
```
import heapq
INF = 10**9+1
def solve():
n_V,n_E,r = map(int, input().split())
graph = {v:[] for v in range(n_V)}
for _ in range(n_E):
u,v,w = map(int, input().split())
graph[u].append((v,w))
min_distances = [INF]*n_V; min_distances[r] = 0
prev = [None for _ in range(n_V)]
... | output | 1 | 72,463 | 13 | 144,927 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,464 | 13 | 144,928 |
"Correct Solution:
```
import heapq
inf = 10000000000
n,m,r = map(int,input().split())
e = [[] for _ in range(n)]
for _ in range(m):
a,b,c = map(int,input().split())
e[a].append([b,c])
d = [inf]*n
d[r] = 0
pq = [[0,r]]
heapq.heapify(pq)
while len(pq):
pre = heapq.heappop(pq)
a,b = pre[0],pre[1]
... | output | 1 | 72,464 | 13 | 144,929 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,465 | 13 | 144,930 |
"Correct Solution:
```
from heapq import heappush,heappop,heapify
INF=10**30
def dijkstra(G,s,n):
que=[(0,s)]
dist=[INF]*n
dist[s]=0
while que:
mincost,u=heappop(que)
if(mincost>dist[u]):
continue
for c,v in G[u]:
if(dist[u]+c<dist[v]):
di... | output | 1 | 72,465 | 13 | 144,931 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,466 | 13 | 144,932 |
"Correct Solution:
```
def main():
V,E,r,*L = map(int,open(0).read().split())
INF = float("inf")
G = [[] for _ in range(V)]
for s,t,c in zip(*[iter(L)]*3):
G[s].append((t,c))
for i in dijkstra(G,r):
if i==INF:
print("INF")
else:
print(i)
from heapq import heappop,heappush
def dijkstra(G:list, source=0... | output | 1 | 72,466 | 13 | 144,933 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,467 | 13 | 144,934 |
"Correct Solution:
```
'''
????????£????????????????????????
'''
import queue
v,e,s=map(int,input().split())
edge=[]
inf =1000000100
for i in range(v):
edge.append([])
for i in range(e):
vs,vt,d=map(int,input().split())
edge[vs].append((vt,d))
dis=[]
for i in range(v):
dis.append(inf)
dis[s]=0
... | output | 1 | 72,467 | 13 | 144,935 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,468 | 13 | 144,936 |
"Correct Solution:
```
#=============================================================================
# ダイクストラ法
#=============================================================================
import heapq
N,M,s=map(int,input().split())
Graph=[[] for _ in range(N+1)]
dig=["INF" for _ in range(N+1)]
see=[False for _ in ra... | output | 1 | 72,468 | 13 | 144,937 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,469 | 13 | 144,938 |
"Correct Solution:
```
from heapq import heappush, heappop
INF = 10 ** 12
V, E, r = map(int, input().split())
graph = [[] for _ in range(V)]
dist_all = [INF] * V
dist_all[r] = 0
for i in range(E):
start, end, dist1 = map(int, input().split())
graph[start].append([end, dist1])
q = []
heappush(q, (0, r))
while... | output | 1 | 72,469 | 13 | 144,939 |
Provide a correct Python 3 solution for this coding contest problem.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* ... | instruction | 0 | 72,470 | 13 | 144,940 |
"Correct Solution:
```
import heapq
v, e, r = map(int, input().split())
g = [[] for _ in range(v)]
for i in range(e):
s, t, d = map(int, input().split())
g[s].append((d, t))#(重み, 次の頂点)
dist = [float("inf")] * v
visited = [False] * v
dist[r] = 0
visited[r] = True
candidate = []
for i in g[r]:
heapq.heappus... | output | 1 | 72,470 | 13 | 144,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 1... | instruction | 0 | 72,471 | 13 | 144,942 |
Yes | output | 1 | 72,471 | 13 | 144,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 1... | instruction | 0 | 72,472 | 13 | 144,944 |
Yes | output | 1 | 72,472 | 13 | 144,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 1... | instruction | 0 | 72,473 | 13 | 144,946 |
Yes | output | 1 | 72,473 | 13 | 144,947 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.