D
D
DeNissss44442021-07-31 00:23:30
Java
DeNissss4444, 2021-07-31 00:23:30

Why is it written in Inpute that 8 values ​​need to be created, while in the example 23 values ​​are entered?

I am solving a problem and I can’t understand its condition, more precisely, the Input section and the Example section. It's just that Inpute says that you need to create 8 values, and in the example, 23 values ​​are entered. Please tell me why is that?

You are given a list of cities. Each direct connection between two cities has its transportation cost (an integer bigger than 0). The goal is to find the paths of minimum cost between pairs of cities. Assume that the cost of each path (which is the sum of costs of all direct connections belonging to this path) is at most 200000. The name of a city is a string containing characters a,...,z and is at most 10 characters long.2)

Input

s [the number of tests <= 10]
n [the number of cities <= 10000]
NAME [city name]
p [the number of neighbors of city NAME]
nr cost [nr - index of a city connected to NAME (the index of the first city is 1)]
           [cost - the transportation cost]
r [the number of paths to find <= 100]
NAME1 NAME2 [NAME1 - source, NAME2 - destination]
[empty line separating the tests]


Output
cost [the minimum transportation cost from city NAME1 to city NAME2 (one per line)]


example
Input:
1        
4         
Gdansk  
2       - 
2 1      
3 3     
Bydgoszcz  
3      
1 1
3 1
4 4
torun
3
1 3
2 1
4 1
warszawa
2
2 4
3 1
2
gdansk warszawa
bydgoszcz warszawa

Output:
3
2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2021-07-31
@DeNissss4444

Because there are several cities. Only one appears in the description of the input format, the rest have the same format. And each city has an arbitrary number of roads.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question