Problem in Timus 1003

Revision en6, by 0xHEXHACKER, 2020-06-06 18:38:54

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English 0xHEXHACKER 2020-06-06 18:38:54 87
en5 English 0xHEXHACKER 2020-06-06 18:36:23 2 Tiny change: 'mmunity,\nI was tr' -> 'mmunity,\n\nI was tr'
en4 English 0xHEXHACKER 2020-06-06 18:34:53 8
en3 English 0xHEXHACKER 2020-06-06 18:33:32 0 (published)
en2 English 0xHEXHACKER 2020-06-06 18:32:49 43 (saved to drafts)
en1 English 0xHEXHACKER 2020-06-06 18:31:56 684 Initial revision (published)