QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 10

#11663. The Game

統計

The board consists of $2n + 1$ numbered fields. There are $n$ black and $n$ white pawns. The black pawns are located on $n$ first fields of the board (the fields numbered from $1$ to $n$), whereas the white pawns are located on the last $n$ fields (the fields numbered from $n + 2$ to $2n + 1$). Initially, only the $(n + 1)$-th field is empty.

problem_11663_1.png
a. the initial configuration of pawns on the board for $n = 3$ and possible moves of the pawns
b. the board after moving the white pawn from the field number 5 and possible moves of the pawns

During the game, two types of moves can be performed. The first one is a shift of a pawn to the adjacent free field. The second move - jump, consists of jumping over a single adjacent pawn of a different colour and landing on the free field.

The goal of the game is to exchange the positions of white and black pawns. In the other words, the black pawns have to be moved to the fields numbered from $n+2$ to $2n+1$, while the white pawns should be moved to the fields numbered from $1$ to $n$. Find the shortest sequence of moves which accomplishes the goal of the game.

Task

Write a program, which:

  • reads a number $n$ denoting the number of white and black pawns,
  • determines the shortest sequence of moves leading to the goal of the game,
  • writes the answer.

Input

The first and only line of standard input contains a single integer $n$ ($1 \le n \le 100$).

Output

The first line of standard output should contain number $m$ denoting the minimal length of a sequence of moves leading to the goal of the game. Each of the following $m$ lines should contain one integer from the range $[1,2n + 1]$. Integer from the line number $(i + 1)$ (for $1 \le i \le m$) defines the number of the field, from which the pawn is being moved during $i$-th move.

If there are many possible solutions, your program can output any of them.

Example

Input

1

Output

3
1
3
2

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.