oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

puzzle Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

puzzle.html

Even though the prisoners have left the jail cell and landed on Earth, Aggregor was smart enough to capture them back one by one. He successfully absorbs the powers by using Professor Paradox’s time machine and transforming him into a very powerful monster.

Azmuth explains that Aggregor intends to use his new powers in order for the huge trial ahead: collecting the pieces of the Map of Infinity. Hence, Ben and Gwen must stop Aggregor from obtaining the four pieces of the Map of Infinity.

However, Ben and Gwen have failed to stop Aggregor from collecting the first three pieces of the Map of Infinity. The last piece of the map is hidden deep within the Perplexahedron Puzzle. Ben and Gwen have no clue how to get there before Aggregor does and hence asks for your help to navigate their way.

The way to find the last piece of the map is simple.

Each room of the perplexahedron has a number. Everytime you enter a room, that number is added to your score.

You may enter the perplexahedron from any point in the top row and can exit from any point in the bottom row.

You can move downwards, left or right, but you cannot move upwards nor can you visit the same room twice.

If you get the maximum score possible after completing your journey, the last piece of the map of infinity will appear before you.

The first line of the input will be the two integers n (1 ≤ n ≤ 100) and m (1 ≤ m ≤ 100). The following n rows each contain m integers representing the perplexahedron matrix. No score will be more than 10000 or less than -10000.

Output the best possible total score that can be obtained.

Sample Input 1

4 4
2 0 -3 4
1 0 -2 -6
3 -7 12 4
-1 8 -1 2

Sample Output 1

27

Explanation

The best amount can be obtained by starting from the top right corner. The route is left left left down right right down right down left left.

Tags

NOI 2011 Sec Selection Test 1

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s32MBAverage
2011s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o puzzle -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.