877C.md (1601B)
1 Source: https://codeforces.com/problemset/problem/877/C 2 3 C. Slava and tanks 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map. 22 23 Formally, map is a checkered field of size 1 × *n*, the cells of which are numbered from 1 to *n*, in each cell there can be one or several tanks. Slava doesn't know the number of tanks and their positions, because he flies very high, but he can drop a bomb in any cell. All tanks in this cell will be damaged. 24 25 If a tank takes damage for the first time, it instantly moves to one of the neighboring cells (a tank in the cell *n* can only move to the cell *n* - 1, a tank in the cell 1 can only move to the cell 2). If a tank takes damage for the second time, it's counted as destroyed and never moves again. The tanks move only when they are damaged for the first time, they do not move by themselves. 26 27 Help Slava to destroy all tanks using as few bombs as possible. 28 29 Input 30 31 The first line contains a single integer *n* (2 ≤ *n* ≤ 100 000) — the size of the map. 32 33 Output 34 35 In the first line print *m* — the minimum number of bombs Slava needs to destroy all tanks. 36 37 In the second line print *m* integers *k*1, *k*2, ..., *k**m*. The number *k**i* means that the *i*-th bomb should be dropped at the cell *k**i*. 38 39 If there are multiple answers, you can print any of them. 40 41 Examples 42 43 Input 44 45 ``` 46 2 47 ``` 48 49 Output 50 51 ``` 52 3 53 2 1 2 54 ``` 55 56 Input 57 58 ``` 59 3 60 ``` 61 62 Output 63 64 ``` 65 4 66 2 1 3 2 67 ```