2191 - Rub Task 2191 - Rub Task 2191 - Rub Task

Statistics Sub: 383 | AC: 122 | AC%: 31,85 | Score: 1,38
Created by Vladimir Antonio Charchabal Escalona
Added by Vlade087 (2012-12-04)
Limits
Total Time: 30000 MS | Test Time: 3000 MS |Memory: 62 MB | Output: 64 MB | Size: 14 KB
Enabled languages
Available in

Description

Rub is a boy lover of mathematics, and specifically likes many grids. Searching the internet he came across an old problem, which gave him a NxM grid, he wants to determine a sequence of squares in the grid from the leftmost column to the rightmost column, and the sum of all sequence elements is minimized. Only allowed in the sequence boxes that share at least one side adjacent to the four directions.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

Rub is a boy lover of mathematics, and specifically likes many grids. Searching the internet he came across an old problem, which gave him a NxM grid, he wants to determine a sequence of squares in the grid from the leftmost column to the rightmost column, and the sum of all sequence elements is minimized. Only allowed in the sequence boxes that share at least one side adjacent to the four directions.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

Rub is a boy lover of mathematics, and specifically likes many grids. Searching the internet he came across an old problem, which gave him a NxM grid, he wants to determine a sequence of squares in the grid from the leftmost column to the rightmost column, and the sum of all sequence elements is minimized. Only allowed in the sequence boxes that share at least one side adjacent to the four directions.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

Input specification

The first line of the input is two integers N and M, 1 <= N, M <= 100, the following N lines have M integers 0 <= Mi, j <= 100000.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

The first line of the input is two integers N and M, 1 <= N, M <= 100, the following N lines have M integers 0 <= Mi, j <= 100000.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

The first line of the input is two integers N and M, 1 <= N, M <= 100, the following N lines have M integers 0 <= Mi, j <= 100000.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

Output specification

The output is an integer that represents the minimum sum of the sequence that rub must find.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

The output is an integer that represents the minimum sum of the sequence that rub must find.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

The first line of the input is two integers N and M, 1 <= N, M <= 100, the following N lines have M integers 0 <= Mi, j <= 100000.

;jsessionid=0B08964DD49D6D93B63A9F1C50233A13

Sample input

3 3
1 0 5
5 1 7
3 1 1

Sample output

4

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 3378 | 1873 | 2824 | 3573 | 3599 | 1946