Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

Problem in Timus 1003

Правка en6, от 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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский 0xHEXHACKER 2020-06-06 18:38:54 87
en5 Английский 0xHEXHACKER 2020-06-06 18:36:23 2 Tiny change: 'mmunity,\nI was tr' -> 'mmunity,\n\nI was tr'
en4 Английский 0xHEXHACKER 2020-06-06 18:34:53 8
en3 Английский 0xHEXHACKER 2020-06-06 18:33:32 0 (published)
en2 Английский 0xHEXHACKER 2020-06-06 18:32:49 43 (saved to drafts)
en1 Английский 0xHEXHACKER 2020-06-06 18:31:56 684 Initial revision (published)