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

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

I don't understand why I get MLE on this problem https://codeforces.me/contest/1955/problem/G when using bfs.

Here is the code: https://codeforces.me/contest/1955/submission/255789320.

I was able to solve it later with dfs, but I'm still confused why this bfs that i wrote does not work. Obviously the problem is in this queue Q, but after every bfs call it should be empty again, so size of Q is always <= 100 * 100, which should not get out of memory limit. I would appreciate if someone will help me understand this.

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

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

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

This is my solution for a problem F Is it flower? from a Div 3 codeforces round 863. https://codeforces.me/contest/1811/submission/205309461

I dont realy understand why do i get TLE. I think my bfs algorithm passes through every node of the graph only once which i think should not get TLE. Can someone tell me why is this program too slow?

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

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