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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parall... | instruction | 0 | 62,410 | 1 | 124,820 |
Tags: brute force, geometry, greedy, implementation
Correct Solution:
```
(n, sx, sy) = map(int, input().split())
boy = list()
for i in range(n):
(x, y) = map(int, input().split())
boy.append([x, y])
test = list()
test.append([0, sx, sy + 1])
test.append([0, sx + 1, sy])
test.append([0, sx, sy - 1])
test.appen... | output | 1 | 62,410 | 1 | 124,821 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parall... | instruction | 0 | 62,411 | 1 | 124,822 |
Tags: brute force, geometry, greedy, implementation
Correct Solution:
```
import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER
@atexit.register
def write():
sys.__stdout__.write(_OUTPUT_BUFFE... | output | 1 | 62,411 | 1 | 124,823 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parall... | instruction | 0 | 62,412 | 1 | 124,824 |
Tags: brute force, geometry, greedy, implementation
Correct Solution:
```
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
#from bisect import bisect_left as bl #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br #c++ upperbound br(array,element... | output | 1 | 62,412 | 1 | 124,825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parall... | instruction | 0 | 62,413 | 1 | 124,826 |
Tags: brute force, geometry, greedy, implementation
Correct Solution:
```
import sys
def LI():
return map(int, sys.stdin.readline().split())
[N, sx, sy] = LI()
pts = [(0, 1), (1, 0), (0, -1), (-1, 0)]
v = [0] * 4
for _ in range(N):
[x, y] = LI()
if x > sx: v[1] += 1
if x < sx: v[3] += 1
if y > sy:... | output | 1 | 62,413 | 1 | 124,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parall... | instruction | 0 | 62,414 | 1 | 124,828 |
Tags: brute force, geometry, greedy, implementation
Correct Solution:
```
from sys import stdin, stdout
input = stdin.readline
def inputnums():
return(map(int,input().split()))
n, sx, sy = inputnums()
N = 0
S = 0
E = 0
W = 0
for i in range(n):
l = [int(x) for x in input().split(' ')]
if l[1] > sy:
N... | output | 1 | 62,414 | 1 | 124,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,415 | 1 | 124,830 |
Yes | output | 1 | 62,415 | 1 | 124,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,416 | 1 | 124,832 |
Yes | output | 1 | 62,416 | 1 | 124,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,417 | 1 | 124,834 |
Yes | output | 1 | 62,417 | 1 | 124,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,418 | 1 | 124,836 |
Yes | output | 1 | 62,418 | 1 | 124,837 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,419 | 1 | 124,838 |
Yes | output | 1 | 62,419 | 1 | 124,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,420 | 1 | 124,840 |
No | output | 1 | 62,420 | 1 | 124,841 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,421 | 1 | 124,842 |
No | output | 1 | 62,421 | 1 | 124,843 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,422 | 1 | 124,844 |
No | output | 1 | 62,422 | 1 | 124,845 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four... | instruction | 0 | 62,423 | 1 | 124,846 |
No | output | 1 | 62,423 | 1 | 124,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,495 | 1 | 124,990 |
Tags: dsu, graphs, greedy
Correct Solution:
```
from collections import defaultdict
from math import ceil, sqrt, floor
from heapq import heappush,heappop
import sys
inf = float("inf")
class DisjointSet:
def __init__(self, n):
self.n = n
self.par = [-1] * n
self.nc = n
def findParent(self, i):
if self.par[i... | output | 1 | 62,495 | 1 | 124,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,496 | 1 | 124,992 |
Tags: dsu, graphs, greedy
Correct Solution:
```
"""
Author - Satwik Tiwari .
15th Dec , 2020 - Tuesday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import F... | output | 1 | 62,496 | 1 | 124,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,497 | 1 | 124,994 |
Tags: dsu, graphs, greedy
Correct Solution:
```
from collections import defaultdict
class DisjointSet:
def __init__(self, element_num=None):
self._father = {}
self._rank = {}
if element_num is not None:
for i in range(element_num):
self.add(i)
def add(self... | output | 1 | 62,497 | 1 | 124,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,498 | 1 | 124,996 |
Tags: dsu, graphs, greedy
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
def __init__(self, file):
self.newlines = 0
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r... | output | 1 | 62,498 | 1 | 124,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,499 | 1 | 124,998 |
Tags: dsu, graphs, greedy
Correct Solution:
```
"""
#If FastIO not needed, use this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorTyp... | output | 1 | 62,499 | 1 | 124,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,500 | 1 | 125,000 |
Tags: dsu, graphs, greedy
Correct Solution:
```
import math
from sys import stdin
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
def uf_union(a,b,p,rank):
ap = uf_find(a,p)
bp = uf_find(b,p)
if ap == bp:
... | output | 1 | 62,500 | 1 | 125,001 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,501 | 1 | 125,002 |
Tags: dsu, graphs, greedy
Correct Solution:
```
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
from collections import defaultdict
def merge(a,b):
par[a]=b
def find(a):
if par[a]==-1:
return a
stack=[]
while par[a]!=-1:
stack.append(a)
a=par... | output | 1 | 62,501 | 1 | 125,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city.
The Berland Transport Ministry is... | instruction | 0 | 62,502 | 1 | 125,004 |
Tags: dsu, graphs, greedy
Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 13 16:13:20 2021
@author: kissz
"""
import sys
def generate_testcase():
import random
with open('in.txt','w') as f:
print(1,file=f)
print(200000,200000,500000,file=f)
data=[(i,i+1,random.ran... | output | 1 | 62,502 | 1 | 125,005 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,503 | 1 | 125,006 |
Yes | output | 1 | 62,503 | 1 | 125,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,504 | 1 | 125,008 |
Yes | output | 1 | 62,504 | 1 | 125,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,505 | 1 | 125,010 |
Yes | output | 1 | 62,505 | 1 | 125,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,506 | 1 | 125,012 |
Yes | output | 1 | 62,506 | 1 | 125,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,507 | 1 | 125,014 |
No | output | 1 | 62,507 | 1 | 125,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,508 | 1 | 125,016 |
No | output | 1 | 62,508 | 1 | 125,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,509 | 1 | 125,018 |
No | output | 1 | 62,509 | 1 | 125,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any ... | instruction | 0 | 62,510 | 1 | 125,020 |
No | output | 1 | 62,510 | 1 | 125,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,531 | 1 | 125,062 |
Tags: combinatorics, greedy, math
Correct Solution:
```
import math
n=int(input())
while(n!=0):
n-=1
t=int(input())
a=list(map(int,input().split()))
new=0
for i in range(len(a)):
new+=a[i]
k=new%t
ans=k*(t-k)
print(ans)
``` | output | 1 | 62,531 | 1 | 125,063 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,532 | 1 | 125,064 |
Tags: combinatorics, greedy, math
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
c2 = s % n
c1 = n - c2
print(c1 * c2)
``` | output | 1 | 62,532 | 1 | 125,065 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,533 | 1 | 125,066 |
Tags: combinatorics, greedy, math
Correct Solution:
```
for _ in range(int(input())):
l = int(input())
nums = list(map(int, input().split()))
s = sum(nums)%l
print(s*(l-s))
``` | output | 1 | 62,533 | 1 | 125,067 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,534 | 1 | 125,068 |
Tags: combinatorics, greedy, math
Correct Solution:
```
###### ### ####### ####### ## # ##### ### #####
# # # # # # # # # # # # # ###
# # # # # # # # # # # # # ###
#####... | output | 1 | 62,534 | 1 | 125,069 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,535 | 1 | 125,070 |
Tags: combinatorics, greedy, math
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
sum = 0
for i in l:
sum = sum + i
k = sum % n
print(k*(n-k))
``` | output | 1 | 62,535 | 1 | 125,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,536 | 1 | 125,072 |
Tags: combinatorics, greedy, math
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
suma = 0
for x in a:
suma += x
diff = suma // n
larger = suma - diff * n
less = n - larger
print(less * larger)
``` | output | 1 | 62,536 | 1 | 125,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,537 | 1 | 125,074 |
Tags: combinatorics, greedy, math
Correct Solution:
```
import collections
t = int(input())
for i in range(0,t):
n = int(input())
cars = list(map(int, input().split()))
cars = sorted(cars)
while (cars[n-1] - cars[0] > 1):
x = 0
y = n-1
while x<=y:
total = cars[x]+ca... | output | 1 | 62,537 | 1 | 125,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a... | instruction | 0 | 62,538 | 1 | 125,076 |
Tags: combinatorics, greedy, math
Correct Solution:
```
import math
t=int(input())
for _ in range (t):
n=int(input())
l=list(map(int, input().split()))
total=sum(l)
avg=total/n
avgr=total//n
if avg==avgr:
print (0)
else:
c=round(((avg-avgr)*n))
ans=(c*(n-c))
print (... | output | 1 | 62,538 | 1 | 125,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,539 | 1 | 125,078 |
Yes | output | 1 | 62,539 | 1 | 125,079 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,540 | 1 | 125,080 |
Yes | output | 1 | 62,540 | 1 | 125,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,541 | 1 | 125,082 |
Yes | output | 1 | 62,541 | 1 | 125,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,542 | 1 | 125,084 |
Yes | output | 1 | 62,542 | 1 | 125,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,543 | 1 | 125,086 |
No | output | 1 | 62,543 | 1 | 125,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,544 | 1 | 125,088 |
No | output | 1 | 62,544 | 1 | 125,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,545 | 1 | 125,090 |
No | output | 1 | 62,545 | 1 | 125,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divi... | instruction | 0 | 62,546 | 1 | 125,092 |
No | output | 1 | 62,546 | 1 | 125,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they... | instruction | 0 | 62,732 | 1 | 125,464 |
No | output | 1 | 62,732 | 1 | 125,465 |
Provide a correct Python 3 solution for this coding contest problem.
problem
In the area where Kazakhstan is now located, there used to be a trade route called the "Silk Road".
There are N + 1 cities on the Silk Road, numbered from west as city 0, city 1, ..., city N. The distance between city i -1 and city i (1 β€ i... | instruction | 0 | 63,065 | 1 | 126,130 |
"Correct Solution:
```
#Dει‘
N,M = map(int,input().split())
D = [int(input()) for i in range(N)]
C = [int(input()) for j in range(M)]
inf = float("inf")
dp = [[inf for i in range(N+1)] for j in range(M+1)]
dp[0][0] = 0
for j in range(M):
dp[j+1] = dp[j][0:N+1]
for i in range(N):
if dp[j][i] != inf:
... | output | 1 | 63,065 | 1 | 126,131 |
Provide a correct Python 3 solution for this coding contest problem.
problem
In the area where Kazakhstan is now located, there used to be a trade route called the "Silk Road".
There are N + 1 cities on the Silk Road, numbered from west as city 0, city 1, ..., city N. The distance between city i -1 and city i (1 β€ i... | instruction | 0 | 63,066 | 1 | 126,132 |
"Correct Solution:
```
# AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7fffffff
n, m = map(int, input().split())
d = [int(input()) for i in range(n)]
c = [0] + [int(input()) for i in range(m)]
dp = [[INF for j in range(n+1)] for i in range(2)]
dp[0][0] = ... | output | 1 | 63,066 | 1 | 126,133 |
Provide a correct Python 3 solution for this coding contest problem.
problem
In the area where Kazakhstan is now located, there used to be a trade route called the "Silk Road".
There are N + 1 cities on the Silk Road, numbered from west as city 0, city 1, ..., city N. The distance between city i -1 and city i (1 β€ i... | instruction | 0 | 63,067 | 1 | 126,134 |
"Correct Solution:
```
# AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7fffffff
n, m = map(int, input().split())
d = [int(input()) for i in range(n)]
c = [int(input()) for i in range(m)]
dp = [[INF for j in range(n+1)] for i in range(m+1)]
dp[0][0] = 0
fo... | output | 1 | 63,067 | 1 | 126,135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.