CCC '25 J5 - Connecting Territories


Submit solution

Points: 1
Time limit: 5.0s
Memory limit: 256M

Problem type
Allowed languages
C++, Python
2 There are at most \(100\) rows and at most \(100\) columns. \(R \le 100\) and \(C \le 100\) 2 The grid may be very large. \(R \le 20\ 000\) and \(C \le 20\ 000\)

Output Specification

Output the positive integer, \(P\) , which is the minimum cost of a connecting path between the upper and lower territories.

Sample Input

3
5
7

Sample Output

6

Explanation for Sample Output

The cost of each tile is shown. The sequence of tiles that Ava should purchase to minimize the cost of a connecting path is highlighted in green.


Comments

There are no comments at the moment.