CF1770F.Koxia and Sequence

NOI/NOI+/CTSC

通过率:0%

时间限制:1.00s

内存限制:256MB

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
  • a1 ∣ a2 ∣ … ∣ an=ya_1 \, | \, a_2 \, | \, \ldots \, | \, a_n=y, where ∣| denotes the bitwise OR operation.

The score of a good array is the value of a1⊕a2⊕…⊕ana_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.

玛莉有三个整数 nn、xx 和 yy。

称一个由 nn 个非负整数组成的数组 aa 是“好的”,当且仅当它满足以下两个条件:

  • a1+a2+…+an=xa_1+a_2+\ldots+a_n=x,且
  • a1 ∣ a2 ∣ … ∣ an=ya_1 \, | \, a_2 \, | \, \ldots \, | \, a_n=y,其中 ∣| 表示按位或运算。

一个“好的”数组的得分定义为 a1⊕a2⊕…⊕ana_1 \oplus a_2 \oplus \ldots \oplus a_n 的值,其中 ⊕\oplus 表示按位异或运算。

Koxia 希望你求出所有“好的”数组的得分的按位异或总和。若不存在任何“好的”数组,则输出 00。

输入格式

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

输入的第一行包含三个整数 nn、xx 和 yy(1≤n<2401 \leq n \lt 2^{40},0≤x<2600 \leq x \lt 2^{60},0≤y<2200 \leq y \lt 2^{20})。

输出格式

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

输出一个整数——所有好数组的得分的按位异或(XOR)总和。

输入输出样例

  • 输入#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 0⊕2⊕3=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 1⊕2⊕2=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 1⊕1⊕3=31 \oplus 1 \oplus 3 = 3.

Therefore, the total bitwise xor of the scores is 1⊕…⊕1⏟9 times⊕3⊕3⊕3=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.

在第一个测试用例中,总共有 1212 个好数组,如下所示:

  • [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] 和 [3,2,0][3,2,0] —— 得分为 0⊕2⊕3=10 \oplus 2 \oplus 3 = 1;
  • [1,2,2][1, 2, 2]、[2,1,2][2, 1, 2] 和 [2,2,1][2, 2, 1] —— 得分为 1⊕2⊕2=11 \oplus 2 \oplus 2 = 1;
  • [1,1,3][1, 1, 3]、[1,3,1][1, 3, 1] 和 [3,1,1][3, 1, 1] —— 得分为 1⊕1⊕3=31 \oplus 1 \oplus 3 = 3。

因此,所有得分的按位异或总和为 1⊕…⊕1⏟9 次⊕3⊕3⊕3=2\underbrace{1 \oplus \ldots \oplus 1}_{9\text{ 次}} \oplus 3 \oplus 3 \oplus 3 = 2。

在第二个测试用例中,不存在好序列。输出应为 00。

输入解题思路,AI测评打分。不知道怎么写?

首页