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

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

Hi!

I tried to solve this problem https://onlinejudge.org/external/106/10600.pdf?fbclid=IwAR2tGCAnxFqS61oAKAMBdN5qQ2zej1Ta1yjj8NN-teRJ8CeA3vNAOsws97U using Kruskal algorithm to find the two minimum spanning trees. The first MST is always correct. Although the logic of the second I implemented is the same, the second MST cost is not correct at all! Kindly Can someone tell me what is wrong with my code? This is my code: https://ideone.com/spXa9w

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

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

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

Hi!

I tried to solve this problem using BFS technique, and it seems that my code has passed test cases of huge number of inputs. However, it didn't pass the test case number 12. I don't know what is the fault I fell in it, because I can't trace this test case as it contains huge number of inputs and at the same time not completely shown. If someone can find the logical problem in my code, I hope to tell me what it is.

Problem: https://mirror.codeforces.com/problemset/problem/580/C

My solution: https://mirror.codeforces.com/contest/580/submission/124986838

Edit (the correct code):

The problem was in pushing the nodes that passed the number of consecutives positions of cats m. The correct submission is here after one of the users found the problem, thanks to him!

corrected submission: https://mirror.codeforces.com/contest/580/submission/124994493

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

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