Pl help getting runtime error

@spagire4
I checked your code against sample test case and it works
Where did you get runtime error

@Aarnav-Jindal-1059677350830863 but i am not getting solution accepted

@spagire4
It was a silly error
bool vis[201][201];
This should be 2001

@Aarnav-Jindal-1059677350830863 did changes as u sad still getting wrong answer

@spagire4
Your answer is correct
Output format is wrong
Output should be this way

#1 : 160
#2 : 155
#3 : 120

If your doubt is resolved please close it