CF1770F.Koxia and Sequence

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Mari has three integers nn , xx , and yy .

Call an array aa of nn non-negative integers good if it satisfies the following conditions:

  • a1+a2++an=xa_1+a_2+\ldots+a_n=x , and
  • a1a2an=ya_1 \, | \, a_2 \, | \, \ldots \, | \, a_n=y , where | denotes the bitwise OR operation.

The score of a good array is the value of a1a2ana_1 \oplus a_2 \oplus \ldots \oplus a_n , where \oplus denotes the bitwise XOR operation.

Koxia wants you to find the total bitwise XOR of the scores of all good arrays. If there are no good arrays, output 00 instead.

输入格式

The first line of input contains three integers nn , xx and yy ( 1n<2401 \leq n < 2^{40} , 0x<2600 \leq x < 2^{60} , 0y<2200 \leq y < 2^{20} ).

输出格式

Output a single integer — the total bitwise XOR of the scores of all good arrays.

输入输出样例

  • 输入#1

    3 5 3

    输出#1

    2
  • 输入#2

    100 0 100

    输出#2

    0
  • 输入#3

    79877974817 749875791743978 982783

    输出#3

    64

说明/提示

In the first test case, there are 1212 good arrays totally as follows.

  • [0,2,3][0,2,3] , [0,3,2][0,3,2] , [2,0,3][2,0,3] , [2,3,0][2,3,0] , [3,0,2][3,0,2] and [3,2,0][3,2,0] — the score is 023=10 \oplus 2 \oplus 3 = 1 ;
  • [1,2,2][1, 2, 2] , [2,1,2][2, 1, 2] and [2,2,1][2, 2, 1] — the score is 122=11 \oplus 2 \oplus 2 = 1 ;
  • [1,1,3][1, 1, 3] , [1,3,1][1, 3, 1] and [3,1,1][3, 1, 1] — the score is 113=31 \oplus 1 \oplus 3 = 3 .

Therefore, the total bitwise xor of the scores is 119 times333=2\underbrace{1 \oplus \ldots \oplus 1}_{9\text{ times}} \oplus 3 \oplus 3 \oplus 3 = 2 .

In the second test case, there are no good sequences. The output should be 00 .

首页