Codeforces will not be available in the period 01:00-05:00 May, 30 (MSK, UTC +3) because of maintenance. ×

Rush's blog

By Rush, history, 2 months ago, In English,

Hello guys.. i read the tutorial and the comments and i can't get it sadly so far.. so if anyone can give me a hint for this problem Magic Formula gonna be grateful too much. The thing that i can't get in the tutorial is the flipping of (i % 1) ^ (i % 2) ^ ..... (i % n) to (1 % i) ^ (2 % i) ^ ..... (3 % i) ... (n % i).. and WHY would he do so.. Thanks in advance.

 
 
 
 
  • Vote: I like it
  • -1
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +1 Vote: I do not like it
$$$Q = \oplus_{i=1}^{n} q_i = \oplus_{i=1}^{n} (p_i \oplus_{j=1}^{n} (i\ mod\ j)) =$$$
$$$(\oplus_{i=1}^{n} p_i)\ \oplus\ (\oplus_{i=1}^{n} \oplus_{j=1}^{n} (i\ mod\ j)) =$$$
$$$(\oplus_{j=1}^{n} p_j)\ \oplus\ (\oplus_{j=1}^{n} \oplus_{j=1}^{n} (i\ mod\ j)) =$$$
$$$\oplus_{j=1}^{n} (p_j \oplus_{i=1}^{n} (i\ mod\ j)) =$$$
$$$\oplus_{i=1}^{n} (p_i \oplus_{j=1}^{n} (j\ mod\ i)) = \oplus_{i=1}^{n} c_i$$$

because

$$$a\ \oplus\ b = b\ \oplus\ a$$$
  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well thank you so much but the main reason that i didn't get is because there were a lot of mathematical symbols. When someone told me i believe the same thing but like that but can you correct me if i was wrong?

    Q = q1 ^ q2 ^ q3 ^ .... q1 = p1 ^ 1 % 1 ^ 1 % 2 ^ 1 % 3 ^ ... ^ 1 % n q2 = p2 ^ 2 % 1 ^ 2 % 2 ^ 2 % 3 ^ ... ^ 2 % n q3 = p3 ^ 3 % 1 ^ 3 % 2 ^ 3 % 3 ^ ... ^ 3 % n then after the rearrangement we can see that we can see that it can be written like that Q = (p1 ^ p2 ^ .... ^pn) ^ (1 % 1 ^ 1 % 2 ^ 1 % 3....) and so on. i believe it's literally the same thing you said but i am weak at math so i didn't get even from the tutorial cause of that many mathematical symbols even if it was easy.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      and i was trying to put it in a nice format but i don't know how typing works in CF even though i left spaced between the sentence. break line