Блог пользователя shubhamphpefy

Автор shubhamphpefy, история, 6 месяцев назад, По-английски

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
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 месяцев назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

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

»
6 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Anyone?

»
6 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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)