I am trying to solve this problem for this input. My code is here. My codeblocks compiler gives output 3. And also a online compiler "ideone" (code) gives output 3. But in my submission it gives output 2. I don't know why this kind different output in different compilers. Please anyone help me. Thanks in advanced.
if(adjn == pre) continue;
pre is not initilized and equals to 4 when cn = 3, adjn = 4
Thanks goo.gl_SsAhv. I have got the bugs. I got accepted after 20 wrong answers. Thanks again.