I haven't used codeblocks or any other ide on a Linux system before,So what changes will the Linux system cause?
You can build a lot simpler code than this by using STL containers. Build an adjacency list using <list> to get neighbours of a vertex.
Start with an origin. Mark it as visited. Use a while loop which terminates when the queue is empty.Then use<queue> container and push all neighbours of that origin on the queue. Using list iterator keep repeating this process for every element in the queue. Print out at the start of while loop.
There you go.
I have implemented the solution for the entire problem . But it is failing many test cases. So here is my solution for the FIRST subtask where there are no limitations on d( that is the number of consecutive steps in a particular direction). But this solution is ALSO failing and can't figure out why.
Can you all please view this and point out my mistake?