lYK, Run! (run)

Source: Internet
Author: User

lYK, Run! (run)
Time limit:5000ms Memory LIMIT:64MB
"Title description"
lYK trapped in a maze! This maze is the shape of a grid diagram. lYK begins at (a) position, exit at (n,m). And there are a lot of monsters in this maze, if there is a monster in row B of line A, and lYK is in row C, then the monster is |a-c|+|b-d| to its threat level. lYK wanted to find a path that would allow it to reach (n,m) and, as far as possible, threaten the monsters with the least amount of threat on the way. Of course, if there is a monster at the beginning or at the end, no matter what the path, the least threatening beast always = 0.
"Input Format" (run.in)
The first line is two numbers n,m.
The next n rows, the number of M per line, if the number is 0, indicates there is no monster in that position, otherwise there is a monster.
The data guarantees that there is at least one monster.
"Input Format" (run.out)
A number represents the answer.
"Input Sample"
3 4
0 1 1 0
0 0 0 0
1 1 1 0
"Output Example"
1
"Data Range"
For data n=1 of 20%.
For data n<=2 of 40%.
For data n,m<=10 of 60%.
For data n,m<=100 of 80%.
For data n,m<=1000 of 90%.
For another 10% of the data n,m<=1000 and the number of monsters <=100.

"Problem Analysis"

  

lYK, Run! (run)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.