#arc124b. [arc124_b]XOR Matching 2
[arc124_b]XOR Matching 2
Problem Statement
Given are sequences and , each of length , consisting of non-negative integers. The -th elements of and are and , respectively.
A non-negative integer is said to be good when the following condition is satisfied:
- Condition: It is possible to permute so that holds for every integer such that , where is the bitwise XOR.
List all good integers in ascending order.
What is ?
The bitwise of integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if exactly one of and is , and otherwise.
For example, we have (in base two: ).
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
In the first line, print , the number of good integers. Then, print more lines. In the -th of these lines, print the -th smallest good integer.
Sample Input 1
Sample Output 1
- If we permute into , we have , so is a good integer. There are no other good integers.