Need help to understand XOR operations

Revision en3, by arius1408, 2021-08-25 18:10:34

Hi codeforces, recently I have came across an interesting problem : https://codeforces.com/problemset/problem/617/E. I had a rough time trying to understand the solution of this problem even after i read the tutorial. Basically I can't see why the add() and del() function work because of my lack of knowledges about the XOR operation. Now after a few hours of thinking, I have officially surrendered ... That's why I'm here, asking for an explanation.

P/S : I'm just dumb, especially when it come to math and other similar stuff. Pls don't be to harsh on me ... And just in case, I'm talking about the add() and del() function in the solution. You will find it in the editorial (of course)

Edit : Just in case, I can't seem to understand why adding cnt[favourite ^ v] help me count the number of pair i, j that satisfies l ≤ i ≤ j ≤ r and the xor of the numbers ai, ai + 1, ..., aj is equal to k (favourite).

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English arius1408 2021-08-25 18:10:34 223
en2 English arius1408 2021-08-25 18:00:03 128
en1 English arius1408 2021-08-25 17:57:43 611 Initial revision (published)