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

Блог пользователя Achha...ji

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

This is the error I am getting while I am submitting the code for this problem , and I am not able to figure out the problem as it is giving correct answer on my computer's compiler (GNU GCC) . If someone can identify the cause of the issue please look after it. Here is the link to my solution: https://codeforces.com/contest/230/submission/98808853

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

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

Rewrite if(soe[t.first] && t.second) as if(t.second && soe[t.first])

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

Initialise res value in sqrt_binary function. If the while loop doesn't execute you will have the uninitialized value usage because res was never assigned any value.

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

The sieve is wrong

for(ll j = (ll)i*i ; j <= maxN ; j += i) {
    soe[j] = 0;
}

Take a look at this line for(ll j = (ll)i*i ; j <= maxN ; j += i), you are starting at $$$i^2$$$ instead of $$$2i$$$.