SPOJ Water tricky cases

Revision en1, by darrk_Shark, 2016-12-13 13:06:07

Problem link

I have been trying this problem, My approach is to do two dfs.

First one to determine, if from a cell water can get out of the board following smaller height/equal height cubes.

In second one, I find the smallest height of the surrounding, I call it wall. Then, for each connected water region I check if this cube has height smaller than wall, then I add (wall-current height) to ans.

My solution

Getting WA repeatedly. Need some tricky cases where my solution may fail.

Tags spoj, tricky problem, #wronganswer

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English darrk_Shark 2016-12-13 13:06:07 597 Initial revision (published)