ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
back to board

Discussion of Problem 1029. Ministry

Posted by karan 28 Aug 2013 17:59
I used dijkstra to do in O(mnlog(mn))? Whats your approach?
I used dp
Posted by Nikunj Banka 14 Oct 2013 15:16
I used dynamic programming to solve the question.
dp[floor][room][lastStep]  indicates the best way to reach top when we are on floor, room and the last step is know. Each state of dp is solved in constant time as we have to do only 2 computations at each step. But my approach runs very very slow.
Re: I used dp
Posted by ძამაანთ [Tbilisi SU] 29 Oct 2013 02:39
Two dimensions are enough
Re: Approach
Posted by Han Lin 9 Apr 2014 12:24
DP can solve this problem in O(MN).