Sequences
Time limit2sMemory limit1024 MB
Choose 2n fighters from two copies of each strength 1 to n+1 so that each chosen strength's copies sit x apart, or report -1.
- Level
Medium7 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
A decisive battle is coming. Professor X knows the odds are poor, but he will use every chance he gets. The X-Men army has fighters, and for every strength from to , exactly two fighters have that strength. To win, the X-Men must choose fighters and line them up so that if a fighter with strength is in the line, the other fighter with strength is also in the line, with exactly other fighters standing between them. Both fighters with the same strength must stay in reserve so they can help at the right moment.
Help Professor X find such a lineup, or report that none exists.
Input
The only line of input contains one integer (), which is half the length of the required lineup.
Output
If no such lineup exists, print one number . Otherwise, print the numbers of the lineup.