Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

NITS Local #28

For the first time, we are posting an official editorial of the contest on Codeforces itself. We hope you like it.

Ugly Geometry

Author: invictus_123

Tutorial
Solution

Make Equal

Author: sprkgoyal

Tutorial
Solution O(nlogn)
Solution O(n)

Maximising Flow (Easy Version)

Author: invictus_123

Tutorial
Solution

Maximising Flow (Hard Version)

Author: invictus_123

Tutorial
Solution

Bruno Loves Cat

Author: sprkgoyal

Tutorial
Solution

Checker for Maximising MEX

Author: invictus_123

Backstory
Tutorial
Solution

Difference in Power

Author: invictus_123

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

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

Link to Contest?? :p

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

Link to the problems?

»
4 года назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Hello! Thanks for the contest I wanted to ask about C2 I want to link my solution and I had a doubt..

My mid in the code is (l+r)/2 (which should overflow considering the extreme contraints you guys have set for the question)

Somehow it does not. https://codeforces.com/gym/282041/submission/81949734

Can anyone suggest why did it not overflow?

Also is an O(1) solution possible using a formula? Like assuming a min and taking its value out as per the formula and checking its near bounds

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

    About the overflow: since you are not storing the data (l + r) which is of course out of bounds for the long long type. Instead, you are storing (l + r)/2 which fits in long long. hence you are not getting any overflow. C++ compiler can add a number upto 64 bits and then return the result. It is the variable who decides for the sign and bounds. I hope you understand what I said. And about O(1) solution. I don't know whether O(1) solution exist or not. But if you found any please share with us.