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?