#abc283g. G - Partial Xor Enumeration
G - Partial Xor Enumeration
Score : points
问题描述
对于一个非负整数序列 ,我们定义其“异或值”()为整数 ,满足对于所有非负整数 :
- 如果且仅当在 中有奇数个元素的 位是 时, 的 位为 。
给定一个长度为 的非负整数序列 。
设 $\lbrace s _ 1, s _ 2, \ldots, s _ k\rbrace\ (s _ 1 < s _ 2 < \cdots < s _ k)$ 是所有可以作为 的任意非连续(可能为空)子序列的异或值的所有非负整数集合。
给定整数 和 ,按照顺序输出 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For a sequence of non-negative integers , let us define its as the integer such that, for all non-negative integer :
- the s place of is if and only if there is an odd number of elements among whose s place is .
You are given a sequence of non-negative integers of length .
Let $\lbrace s _ 1,s _ 2,\ldots,s _ k\rbrace\ (s _ 1\lt s _ 2\lt\cdots\lt s _ k)$ be the set of all non-negative integers that can be the of a not-necessarily-contiguous (possibly empty) subsequence of .
Given integers and , print in this order.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print in ascending order of , separated by spaces.
Sample Input 1
4 1 8
2 21 17 21
Sample Output 1
0 2 4 6 17 19 21 23
There are not-necessarily-contiguous subsequences of : $(),(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)$, and , whose s are as follows.
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
- The of is .
Therefore, the set of all non-negative integers that can be the of a subsequence of is .
Sample Input 2
4 3 7
2 21 17 21
Sample Output 2
4 6 17 19 21
Sample Input 3
5 1 1
0 0 0 0 0
Sample Output 3
0
may contain the same value.
Sample Input 4
6 21 21
88 44 82 110 121 80
Sample Output 4
41
Sample Input 5
12 26 48
19629557415 14220078328 11340722069 30701452525 22333517481 720413777 11883028647 20926361028 24376768297 720413777 27999065315 13558621130
Sample Output 5
13558621130 14220078328 14586054825 15518998043 15970974282 16379590008 17091531049 17412316967 17836964726 18263536708 18965057557 19629557415 20282860278 20926361028 21302757781 21908867832 22333517481 22893781403 23595304394 23723463544 24376768297 24885524507 25261923402
Note that the input and output may not fit into a - integer type.
update @ 2024/3/10 11:53:10