0 atcoder#AGC001D. [AGC001D] Arrays and Palindrome
[AGC001D] Arrays and Palindrome
Score : points
Problem Statement
Snuke got a present from his mother on his birthday. The present was a pair of two sequences and , consisting of positive integers. They satisfied all of the following properties:
- The sum of all elements of is .
- The sum of all elements of is .
- Any string of length that satisfies the following two conditions (1) and (2) will also satisfy the condition (3).
- (1) Any of the following forms a palindrome: the first letters, the following letters, the following letters and so on.
- (2) Any of the following forms a palindrome: the first letters, the following letters, the following letters and so on.
- (3) All letters are the same.
He was happy, until one day he lost both of the sequences. Now, he only remembers that the sequence was a permutation of another sequence of length .
To bring him happiness again, his mother has decided to give him another pair of sequences and that satisfies his favorite properties and is consistent with his memory.
Constraints
- The sum of all equals .
Input
The input is given from Standard Input in the following format:
Output
If there exists a pair of sequences and that satisfies the properties and is consistent with Snuke's memory, print three lines. The first line must contain the sequence , the second line must contain the length of the sequence , and the third line must contain the sequence .
If such a pair does not exist (because Snuke's memory is wrong or some other reason), print a single line containing the word Impossible
(case-sensitive).
3 2
2 1
1 2
1
3
6 1
6
6
3
1 2 3
55 10
1 2 3 4 5 6 7 8 9 10
Impossible