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

Автор Danish_amin_01, история, 4 года назад, По-английски

Problem Link.
I am facing Time Limit Exceed in this problem and I am not able to improve my code any further.
(The following code is in python, but I have even tried in same thing in C++ and got TLE for last test case.)

My Code

I have implemented the method from this Link of CP-Algorithms in my code.
Please read my code. I have mentioned what could be the bottleneck in my code, and I don't know how to overcome this problem. If I avoid removing edges from graph, then how should I track what edges not to visit.
Thanks in advance and If you want to help and don't understand what my problem is or anything else just comment for the same I would try to explain better what is my issue here.
Also you can simply comment some links or similar problems related to this so that I can do some further research.
Any kind of help is acceptable :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

Автор Danish_amin_01, история, 4 года назад, По-английски

https://cses.fi/problemset/task/1731 , Can someone please explain me how to approach this problem?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Danish_amin_01, история, 4 года назад, По-английски

Below is the question link. https://cses.fi/problemset/task/1197 In this question I was thinking to get all cyclic paths and then go through all of them to get if any path has a negative value, if there is such a value then just print it and break the loop there itself. But I am having problem in printing all cyclic paths. :(

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится