Hi, I would like to invite you to take part in HackerRank HourRank-8 on 2nd May.

HourRank is an one hour long programming competition. In this round, there will be only 3 problems. We tried to make it interesting for both beginners and experts.

The authors of this round are tunyash, forthright48 and me. Thanks for wanbo for testing the problems.

Top-10 will get a nice HackerRank Tshirt!

Happy Coding!

Update:

Score of the problems are **25-50-75**.

Update:

The contest has ended, congrats to the winners.

Special congrats to uwi for solving all the problems.

How to solve 75pt?

Segment-tree-like data structure.

If optimal path goes through column

m/ 2, we can calculate all such lengths doing dijkstra from middle column. Or we go to the left or right half of columns and do such step recursively again, then take the minimum on each step.