Need help in SnackDown Online Pre-Elimination Round B , problem C

Revision en1, by MohamedHamada_, 2017-06-17 05:06:44

i tried to solve this problem in the contest time but it gave me a WA . today i try to understand why my answer is wrong .i used an accepted code and try some test cases ... one of them was :

1 3 .. .*.*

so it locks like :

and the the fences should (i think) be like :

so my answer is 5 ... but the Accepted code output is 3 !

i can't understand how to but only 3 fences to prevent the snakes communicate with each other . can any one explain this problem to me ?

thanks in advance .

Tags codechef snackdown 2017, ad-hock

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English MohamedHamada_ 2017-06-17 09:31:39 2 Tiny change: 'nce . \n\nUP : the opt' -> 'nce . \n\n### UPD : the opt'
en5 English MohamedHamada_ 2017-06-17 06:13:53 143
en4 English MohamedHamada_ 2017-06-17 05:12:05 84
en3 English MohamedHamada_ 2017-06-17 05:10:11 2 Tiny change: '\n\n1\n3\n*.*.\n.*.* \n\' -> '\n\n1\n3\n\n*.*.\n\n.*.* \n\'
en2 English MohamedHamada_ 2017-06-17 05:08:17 88
en1 English MohamedHamada_ 2017-06-17 05:06:44 783 Initial revision (published)