message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:
* People traveled ... | instruction | 0 | 22,715 | 1 | 45,430 |
No | output | 1 | 22,715 | 1 | 45,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:
* People traveled ... | instruction | 0 | 22,716 | 1 | 45,432 |
No | output | 1 | 22,716 | 1 | 45,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:
* People traveled ... | instruction | 0 | 22,717 | 1 | 45,434 |
No | output | 1 | 22,717 | 1 | 45,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:
* People traveled ... | instruction | 0 | 22,718 | 1 | 45,436 |
No | output | 1 | 22,718 | 1 | 45,437 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,761 | 1 | 45,522 |
"Correct Solution:
```
from heapq import heappush, heappop
INF = 10 ** 20
while True:
n = int(input())
if n == 0:break
buil_point = [None] * n
for _ in range(n):
b, x, y = map(int, input().split())
buil_point[b - 1] = (x, y)
edges = [[] for _ in range(n)]
for i in range(n):
for j in range(... | output | 1 | 22,761 | 1 | 45,523 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,762 | 1 | 45,524 |
"Correct Solution:
```
# AOJ 0155 Spider Jin
# Python3 2018.6.23 bal4u
# 最短経路問題
MAXLEN = 50
MAX = 100
INF = 0x7ffffffffffffff
x = [0]*(MAX+2)
y = [0]*(MAX+2)
dist = [INF]*(MAX+2)
pre = [0]*(MAX+2)
import heapq
def dijkstra(V, to, start, goal):
global dist
dist = [INF]*V
Q = []
dist[start] = 0
heapq.heappush(Q, ... | output | 1 | 22,762 | 1 | 45,525 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,763 | 1 | 45,526 |
"Correct Solution:
```
# AOJ 0155 Spider Jin
# Python3 2018.6.23 bal4u
# 最短経路問題
MAXLEN = 50
MAX = 100
INF = 0x7ffffffffffffff
x = [0]*(MAX+2)
y = [0]*(MAX+2)
d = [[INF for y in range(MAX+2)] for x in range(MAX+2)]
dist = [INF]*(MAX+2)
pre = [0]*(MAX+2)
import heapq
def dijkstra(V, to, start, goal):
global dist
dis... | output | 1 | 22,763 | 1 | 45,527 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,764 | 1 | 45,528 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155
"""
import sys
from sys import stdin
from math import sqrt
input = stdin.readline
def dijkstra(s, G):
BLACK, GRAY, WHITE = 0, 1, 2
d = [float('inf')] * 101
color = [WHITE] * 101
p = [-1] *... | output | 1 | 22,764 | 1 | 45,529 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,765 | 1 | 45,530 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155
"""
import sys
from sys import stdin
from math import sqrt
input = stdin.readline
def dijkstra(s, G):
BLACK, GRAY, WHITE = 0, 1, 2
d = [float('inf')] * 101
color = [WHITE] * 101
p = [-1] *... | output | 1 | 22,765 | 1 | 45,531 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,766 | 1 | 45,532 |
"Correct Solution:
```
# AOJ 0155 Spider Jin
# Python3 2018.6.23 bal4u
# 最短経路問題
MAXLEN = 50
MAX = 100
INF = 0x7ffffffffffffff
x = [0]*(MAX+2)
y = [0]*(MAX+2)
dist = [INF]*(MAX+2)
pre = [0]*(MAX+2)
import heapq
def dijkstra(V, to, start, goal):
global dist
dist = [INF]*V
Q = []
dist[start] = 0
heapq.heappush(Q, ... | output | 1 | 22,766 | 1 | 45,533 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,767 | 1 | 45,534 |
"Correct Solution:
```
from math import sqrt
from heapq import heappush, heappop
while 1:
N = int(input())
if N == 0:
break
G = [[] for i in range(N)]
P = [None]*N
for i in range(N):
b, x, y = map(int, input().split())
P[b-1] = (x, y)
for i in range(N):
xi, yi =... | output | 1 | 22,767 | 1 | 45,535 |
Provide a correct Python 3 solution for this coding contest problem.
The hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a building farther away, you have ... | instruction | 0 | 22,768 | 1 | 45,536 |
"Correct Solution:
```
import heapq
def dijkstra(G, s, g, n):
cost = [10**9] * n
cost[s] = 0
pre = [-1] * n
q = []
heapq.heappush(q, (0, s))
while q:
d, to = heapq.heappop(q)
if to == g:
break
if cost[to] < d:
continue
for n, dist in G[to]... | output | 1 | 22,768 | 1 | 45,537 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
There are N islands and M bridges. Numbers from 1 to N are assigned to each of the N islands. Numbers from 1 to M are also assigned to each of the M bridges.
Gaccho is currently on the first island (at time 0). Gaccho can move from the ai-t... | instruction | 0 | 22,806 | 1 | 45,612 |
"Correct Solution:
```
from collections import deque
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
a, b, c = map(int, input().split())
edges[a - 1].append((b - 1, c))
que = deque()
que.append((0, 0))
ans = -1
while que:
pos, time = que.popleft()
if pos == n - 1:
... | output | 1 | 22,806 | 1 | 45,613 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
There are N islands and M bridges. Numbers from 1 to N are assigned to each of the N islands. Numbers from 1 to M are also assigned to each of the M bridges.
Gaccho is currently on the first island (at time 0). Gaccho can move from the ai-t... | instruction | 0 | 22,807 | 1 | 45,614 |
"Correct Solution:
```
# AOJ 590: One-Time Path
# Python3 2018.7.13 bal4u
INF = 0x7fffffff
import heapq
def dijkstra(V, to, start):
dist = [INF]*V
Q = []
dist[start] = 0
heapq.heappush(Q, (0, start))
while Q:
t, s = heapq.heappop(Q)
if dist[s] < t: continue
for e, cost in to[s]:
if t <= cost and cost < d... | output | 1 | 22,807 | 1 | 45,615 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a ca... | instruction | 0 | 22,876 | 1 | 45,752 |
Tags: data structures, dp, trees
Correct Solution:
```
from sys import stdin, setrecursionlimit
import threading
n = int(stdin.readline())
w = [int(x) for x in stdin.readline().split()]
graph = [{} for x in range(n)]
for road in range(n-1):
u,v,c = [int(x) for x in stdin.readline().split()]
u -= 1
v -= 1
... | output | 1 | 22,876 | 1 | 45,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a ca... | instruction | 0 | 22,877 | 1 | 45,754 |
Tags: data structures, dp, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
adj = [[] for i in range(n)]
for i in range(n-1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
adj[u].append((v, w))
adj[v].append((u, w))
best = [0... | output | 1 | 22,877 | 1 | 45,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connecte... | instruction | 0 | 22,878 | 1 | 45,756 |
No | output | 1 | 22,878 | 1 | 45,757 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,895 | 1 | 45,790 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
from collections import deque
n = int(input())
r1, c1 = [int(x) for x in input().split()]
r2, c2 = [int(x) for x in input().split()]
grafo = []
visited = []
for i in range(n):
tmp = []
for j in range(n):
tmp.append(False)
visited.append(tmp)
for i i... | output | 1 | 22,895 | 1 | 45,791 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,896 | 1 | 45,792 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
from sys import stdout
from sys import stdin
def get():
return stdin.readline().strip()
def getf():
return [int(i) for i in get().split()]
def put(a, end = "\n"):
stdout.write(str(a) + end)
def putf(a, sep = " ", end = "\n"):
stdout.write(sep... | output | 1 | 22,896 | 1 | 45,793 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,897 | 1 | 45,794 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
def reach(x,y, matrix):
res = set()
res.add((x,y))
frontier = set()
isFirst = True
if x - 1 >= 0 and matrix[x-1][y] == 0:
frontier.add((x-1,y))
res.add((x-1,y))
if x + 1 < len(matrix) and matrix[x+1][y] == 0:
... | output | 1 | 22,897 | 1 | 45,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,898 | 1 | 45,796 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
def parseint(s):
return int(s)-1
n = int(input())
r1, c1 = map(parseint, input().split())
r2, c2 = map(parseint, input().split())
graph = []
components = [[], []]
idx = 0
adj = [(0,1),(0,-1),(1,0),(-1,0)]
for _ in range(n):
graph.append(list(inpu... | output | 1 | 22,898 | 1 | 45,797 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,899 | 1 | 45,798 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
from collections import deque
from sys import stdin
input=stdin.readline
def bfs(sx,sy,vis,grid):
points=[[0,1],[0,-1],[1,0],[-1,0]]
q=deque()
q.append([sx,sy])
vis[sx][sy]=0
while q:
x,y=q.popleft()
for ptx,pty in points:
if x+ptx>=0 and y+pty>... | output | 1 | 22,899 | 1 | 45,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,900 | 1 | 45,800 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
import itertools
n = int(input())
x1, y1 = [int(a) - 1 for a in input().split()]
x2, y2 = [int(a) - 1 for a in input().split()]
board = [list(input()) for i in range(n)]
def ma_sens(x, y):
global board
return not (x < 0 or x >= n or y < 0 or y >= ... | output | 1 | 22,900 | 1 | 45,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,901 | 1 | 45,802 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
def dis(u,v):
x1,y1=u
x2,y2=v
return(( (x1-x2)**2 + (y1-y2)**2 ))
def adj(u):
x,y=u
t=[]
#print(x,y)
if x+1<n and a[x+1][y]=='0':
t.append([x+1,y])
if y+1<n and a[x][y+1]=='0':
t.append([x,y+1])
if x-1>=0... | output | 1 | 22,901 | 1 | 45,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each cell in the grid is... | instruction | 0 | 22,902 | 1 | 45,804 |
Tags: brute force, dfs and similar, dsu
Correct Solution:
```
from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import *
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 10**9+7
def isprime(n):
n = abs(int(n))... | output | 1 | 22,902 | 1 | 45,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,903 | 1 | 45,806 |
Yes | output | 1 | 22,903 | 1 | 45,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,904 | 1 | 45,808 |
Yes | output | 1 | 22,904 | 1 | 45,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,905 | 1 | 45,810 |
Yes | output | 1 | 22,905 | 1 | 45,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,906 | 1 | 45,812 |
Yes | output | 1 | 22,906 | 1 | 45,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,907 | 1 | 45,814 |
No | output | 1 | 22,907 | 1 | 45,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,908 | 1 | 45,816 |
No | output | 1 | 22,908 | 1 | 45,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,909 | 1 | 45,818 |
No | output | 1 | 22,909 | 1 | 45,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c wit... | instruction | 0 | 22,910 | 1 | 45,820 |
No | output | 1 | 22,910 | 1 | 45,821 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,230 | 1 | 46,460 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
from collections import defaultdict,Counter
from sys import setrecursionlimit,stdin
setrecursionlimit(10**5)
import threading
input=stdin.readline
#SCC DO BE OP BRUH
def dfs(node,vis,g,ans):
vis[node]=1
for i in g[node]:
if vis[i]==0:
dfs(i,vis,g... | output | 1 | 23,230 | 1 | 46,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,231 | 1 | 46,462 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
def main():
from bisect import bisect_left as bl, bisect_right as br, insort
import sys,math
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip... | output | 1 | 23,231 | 1 | 46,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,232 | 1 | 46,464 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
def main():
from bisect import bisect_left as bl, bisect_right as br, insort
import sys,math
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip... | output | 1 | 23,232 | 1 | 46,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,233 | 1 | 46,466 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
######
from collections import defaultdict,deque,Counter,OrderedDict
from heapq import heappop,heappush
import bisect,sys,threading
mod = 10**9 + 7
def dfs_order(i,visited,G,order):
if visited[i]: return
visited[i] = 1
for j in G[i]:
... | output | 1 | 23,233 | 1 | 46,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,234 | 1 | 46,468 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
__author__ = 'Gleb'
from time import time
from collections import defaultdict
from bisect import bisect_left, bisect_right
n, m = int(input()) + 1, 1000000007
q, p = [[] for i in range(n)], [[] for i in range(n)]
w = [0] + list(map(int, input().split()... | output | 1 | 23,234 | 1 | 46,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,235 | 1 | 46,470 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
n, m = int(input()) + 1, 1000000007
q, p = [[] for i in range(n)], [[] for i in range(n)]
w = [0] + list(map(int, input().split()))
for i in range(int(input())):
u, v = map(int, input().split())
p[u].append(v)
q[v].append(u)
r = set(i for i i... | output | 1 | 23,235 | 1 | 46,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,236 | 1 | 46,472 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
from sys import stdin
def main():
n = int(input())
costs = list(map(int, input().split()))
input()
chlds, prnts = [[] for _ in range(n)], [[] for _ in range(n)]
for total in stdin.read().splitlines():
u, v = map(int, total.s... | output | 1 | 23,236 | 1 | 46,473 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only ... | instruction | 0 | 23,237 | 1 | 46,474 |
Tags: dfs and similar, graphs, two pointers
Correct Solution:
```
mod = 10**9+7
import sys
input = sys.stdin.readline
from collections import deque
class Graph(object):
"""docstring for Graph"""
def __init__(self,n,d): # Number of nodes and d is True if directed
self.n = n
self.graph = [[] for i in range(n)]
s... | output | 1 | 23,237 | 1 | 46,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,238 | 1 | 46,476 |
Yes | output | 1 | 23,238 | 1 | 46,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,239 | 1 | 46,478 |
Yes | output | 1 | 23,239 | 1 | 46,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,240 | 1 | 46,480 |
Yes | output | 1 | 23,240 | 1 | 46,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,241 | 1 | 46,482 |
Yes | output | 1 | 23,241 | 1 | 46,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,242 | 1 | 46,484 |
No | output | 1 | 23,242 | 1 | 46,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,243 | 1 | 46,486 |
No | output | 1 | 23,243 | 1 | 46,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,244 | 1 | 46,488 |
No | output | 1 | 23,244 | 1 | 46,489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to bui... | instruction | 0 | 23,245 | 1 | 46,490 |
No | output | 1 | 23,245 | 1 | 46,491 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.
The fare is cons... | instruction | 0 | 23,382 | 1 | 46,764 |
Tags: binary search, dp
Correct Solution:
```
n = int(input())
times = []
first_90 = 0
first_1440 = 0
sum_90 = 0
sum_1440 = 0
values = []
for i in range(n):
times.append(int(input()))
while (times[first_90] <= times[-1] - 90):
sum_90 -= values[first_90]
first_90 += 1
while (times[first_1440] <= times[-1] - 14... | output | 1 | 23,382 | 1 | 46,765 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.