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

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

Hello CodeForces community,

I was trying to solve Timus OJ problem 1003 using DSU. What I did is that I let a[i] = (number of 1s from index 1 to i) % 2, and a[0] = 0. I am denoting "not" of a number by that number + an offset (say 10^18). So input i j even means that a[j] = a[i-1], so I merge i-1 and j and not i-1 and not j. Input i j odd means that a[j] != a[i-1], so I merge i-1 and not j and not i-1 and j. I have also checked if the input is valid. We can find the contradiction if it exists at any particular step.

Here is my submission.

Can you tell me why my submission is failing test #1?

UPD: I had accidentally put the wrong link in my submission, now fixed.

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

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