atcoder#ABC164F. [ABC164F] I hate Matrix Construction
[ABC164F] I hate Matrix Construction
Score : points
Problem Statement
Given are an integer and arrays , , , and , each of length . Construct an matrix that satisfy the following conditions:
- is an integer.
- .
- If , the bitwise AND of the elements in the -th row is .
- If , the bitwise OR of the elements in the -th row is .
- If , the bitwise AND of the elements in the -th column is .
- If , the bitwise OR of the elements in the -th column is .
However, there may be cases where no matrix satisfies the conditions.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If there exists a matrix that satisfies the conditions, print one such matrix in the following format:
Note that any matrix satisfying the conditions is accepted.
If no matrix satisfies the conditions, print .
2
0 1
1 0
1 1
1 0
1 1
1 0
In Sample Input , we need to find a matrix such that:
- the bitwise AND of the elements in the -st row is ;
- the bitwise OR of the elements in the -nd row is ;
- the bitwise OR of the elements in the -st column is ;
- the bitwise AND of the elements in the -nd column is .
2
1 1
1 0
15 15
15 11
15 11
15 11