Unable to understand the WA verdict

I’ve clearly read the question and the constraints have been taken care of but still i’m getting WA.
Please Help!!
Code: c87HWE - Online C++0x Compiler & Debugging Tool - Ideone.com
If the elephant visits the room once, he chooses the max and then i made that zero.
Also visited[] is maintained so that max is not travesred once the visits equal the no of bottles present

in line 34 and 36, visit[row] should be checked and updated instead of visit[i]…