shubhamphpefy's blog

By shubhamphpefy, history, 6 months ago, In English

I submitted below codes for this problem.I got AC for one and TLE for other. I am unable to find how its happening. Please Help.

AC Submission
TLE Submission
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it -13 Vote: I do not like it

-is-this-fft- Maybe you can help.

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Anyone?

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

In your TLE submission, you are marking the cell as visited when it is in front of the queue, not when it is added.

Let's say you have $$$b3$$$ and $$$c2$$$ in your queue. You will be adding $$$a1$$$ twice as when $$$b3$$$ and $$$c2$$$ arrive in front of the queue, as $$$a1$$$ isn't marked as visited when added by $$$b3$$$, so it will be added again when it is $$$c2$$$'s turn.

This can go upto 8 for points which can be reached from 8 different points.

Random C++ Code (cus I'm bored)