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

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

Hello Codeforces!

Today I was trying to implement the Kruskal's Algorithm and somehow I have implemented the algorithm but I am not sure about the code I have tested it against only two test cases and it is running fine for those two test cases

My implementation

I have used the union-find data structure.

Can you please help check my code and say whether it's correct or not whether will it give the correct output aginst all the test case

and if it's correct can I optimize it any more?

Any suggestion, ideas, or criticism will be highly welcomed. Thank You!!

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

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

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

This is the problem of cses coin piles I have only one doubt why we have to check for this condition min(a, b) * 2 >= max(a, b)? and other approaches and hints will be highly appreciated.

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

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