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

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

https://codeforces.com/contest/1945/problem/H

Hey cfers hope all are doing well can anyone please tell me how to solve this please do share your code and logic thanks.

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

»
2 месяца назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Hints for reaching the solution

1945H - GCD is Greater

Solution
Implementation details

I was in a hurry during the contest, so my implementation was not much neat, here is it anyway 252257639.

This was all but, if somebody have any questions, I will be happy to answer.

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

    we don't need to store the cnt[bit

    True. But if you do store it, your implementation will become a lot simpler. If you have the count of zeroes at each position, then, when you remove $$$a[i]$$$ and $$$a[j]$$$ from the set, you simply decrease the count by $$$0$$$ or $$$1$$$ or $$$2$$$ (depending upon whether the outgoing element has that bit set or unset). Then, if the count is zero, the bitwise AND would contain $$$1$$$ at that position. We can repeat for each bit.

    Sample Submission

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Thank you

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

I've added hints for H : GCD is Greater on CF Step

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

    I loved the editorial I performed all the 4 soln that mention including the wa3 of nlogn too made my clear concepts thnks you