Блог пользователя Taan

Автор Taan, история, 7 лет назад, По-английски

I try this problem on spoj but I get TLE. Someone can help me?

We have a m*n matrix of integer [0,2] and John are currently at the upper left position (row 1, column 1) and he want to come row m column n. He can travel right, left, toward the top, or toward the bottom of the grid. He can not travel on a diagonal. But John only love 0 and 1 so that he decide to chose the path which only have 0,1 and he want to his path is maximum value in decimal. John need your help!

Input:

Line 1: contain two integer m,n.

Line 2..m+1: Each line contains n integers.

Output:

The path which is maximum in decimal

(The input certain that John can come to row m column n)

Example:

Input:

3 5

0 1 2 0 2

0 1 0 0 1

1 2 1 2 1

Output :

0110011

You can sumbit solution here

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Taan (previous revision, new revision, compare).

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Taan (previous revision, new revision, compare).