I am having a tough time with this problem. It is looking like a simple BFS, but I am continuously getting WA. Is it really BFS or I am missing something. Please help me(If possible with a test case).
I had posted the same at topcoder and spoj but can't get the desired help, can somebody help me here for this problem. This code is taking 8 sec and I am taking 10^9 base, how can I reduce the time ?
Can anybody tell me that how can I set my vi so that on opening a X.cpp file with VI it has basic skeleton like(header files, main function, etc.) prewritten in that?