Олимпиадный тренинг

Задача 38990. Error


Задача

Темы: ЕГЭ
The square is lined with N × N cells (1 < N < 30). The EM executor can move around the cells by performing one of two commands in one move: right or up. On command to the right EMU moves to the adjacent right cell, on command up – to the adjacent upper one. The square is bounded by external walls. There can also be internal walls between adjacent square cells. EMU cannot pass through walls. 
At the initial moment of time, the EMU has a supply of fruits equal to the number written in the starting cell. When moving from cell to cell, EMU eats a certain number of fruits. When moving to the right, the EMU eats the number of fruits recorded in the cell it moves to, plus 2 more. When moving up, the EMU eats twice the number of fruits recorded in the cell it moves to, Determine the maximum and minimum number of fruits that remain in the reserve at the EMU, passing from the lower left cell (starting cell) to the upper right one.
Answer two numbers – first the maximum number, then the minimum. Both numbers are specified on the same line, separated by one space.
The source data is a spreadsheet of  N × N, each cell of which corresponds to a square cell. Inner & nbsp;  outer walls are marked with thick lines.