AT_abc283_g.[ABC283G] Partial Xor Enumeration

省选/NOI-

通过率:0%

AC君温馨提醒

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

题目描述

给定一个长度为 NN 的非负整数序列 A=(A1,A2,…,AN)A=(A_1,A_2,\ldots,A_N)。

对于非负整数序列 (a1,a2,…,an)(a_1,a_2,\ldots,a_n),其 xor⁡\operatorname{xor} 定义为:存在一个整数 XX,使得对于所有非负整数 jj,满足以下条件:

  • 当且仅当 a1,…,ana_1,\ldots,a_n 中,用二进制表示时第 2j2^j 位为 11 的数的个数为奇数时,XX 的第 2j2^j 位为 11。

设非负整数集合 {s1,s2,…,sk} (s1<s2<⋯<sk)\lbrace s_1,s_2,\ldots,s_k\rbrace\ (s_1<s_2<\cdots<s_k) 为可以通过 AA 的(不一定连续,可以为空)子序列的 xor⁡\operatorname{xor} 得到的所有整数的集合。

给定整数 L,RL,R,请按顺序输出 sL,sL+1,…,sRs_L,s_{L+1},\ldots,s_R。

输入格式

输入以以下格式从标准输入读入。

NN LL RR A1A_1 A2A_2 …\ldots ANA_N

输出格式

请按升序输出 si (L≤i≤R)s_i\ (L\leq i\leq R),用空格分隔。

输入输出样例

  • 输入#1

    4 1 8
    2 21 17 21

    输出#1

    0 2 4 6 17 19 21 23
  • 输入#2

    4 3 7
    2 21 17 21

    输出#2

    4 6 17 19 21
  • 输入#3

    5 1 1
    0 0 0 0 0

    输出#3

    0
  • 输入#4

    6 21 21
    88 44 82 110 121 80

    输出#4

    41
  • 输入#5

    12 26 48
    19629557415 14220078328 11340722069 30701452525 22333517481 720413777 11883028647 20926361028 24376768297 720413777 27999065315 13558621130

    输出#5

    13558621130 14220078328 14586054825 15518998043 15970974282 16379590008 17091531049 17412316967 17836964726 18263536708 18965057557 19629557415 20282860278 20926361028 21302757781 21908867832 22333517481 22893781403 23595304394 23723463544 24376768297 24885524507 25261923402

说明/提示

数据范围

  • 1≤N≤2×1051\leq N\leq2\times10^5
  • 0≤Ai<260 (1≤i≤N)0\leq A_i<2^{60}\ (1\leq i\leq N)
  • 1≤L≤R≤k1\leq L\leq R\leq k
  • R−L≤2×105R-L\leq2\times10^5
  • 输入均为整数

样例解释 1

AA 的所有可能的(不一定连续)子序列有 (),(2),(17),(21),(2,17),(2,21),(17,21),(21,17),(21,21),(2,17,21),(2,21,17),(2,21,21),(21,17,21),(2,21,17,21)(),(2),(17),(21),(2,17),(2,21),(17,21),(21,17),(21,21),(2,17,21),(2,21,17),(2,21,21),(21,17,21),(2,21,17,21) 共 1414 种。它们的 xor⁡\operatorname{xor} 分别如下:

  • 空序列的 xor⁡\operatorname{xor} 为 00。
  • (2)(2) 的 xor⁡\operatorname{xor} 为 22。
  • (17)(17) 的 xor⁡\operatorname{xor} 为 1717。
  • (21)(21) 的 xor⁡\operatorname{xor} 为 2121。
  • (2,17)(2,17) 的 xor⁡\operatorname{xor} 为 1919。
  • (2,21)(2,21) 的 xor⁡\operatorname{xor} 为 2323。
  • (17,21)(17,21) 的 xor⁡\operatorname{xor} 为 44。
  • (21,17)(21,17) 的 xor⁡\operatorname{xor} 为 44。
  • (21,21)(21,21) 的 xor⁡\operatorname{xor} 为 00。
  • (2,17,21)(2,17,21) 的 xor⁡\operatorname{xor} 为 66。
  • (2,21,17)(2,21,17) 的 xor⁡\operatorname{xor} 为 66。
  • (2,21,21)(2,21,21) 的 xor⁡\operatorname{xor} 为 22。
  • (21,17,21)(21,17,21) 的 xor⁡\operatorname{xor} 为 1717。
  • (2,21,17,21)(2,21,17,21) 的 xor⁡\operatorname{xor} 为 1919。

因此,AA 的子序列的按位异或可能得到的值的集合为 {0,2,4,6,17,19,21,23}\lbrace0,2,4,6,17,19,21,23\rbrace。

样例解释 5

请注意,输入或输出的数值可能超出 32bit⁡32\operatorname{bit} 整数范围。

由 ChatGPT 4.1 翻译

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

首页