304607: CF877C. Slava and tanks
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Slava and tanks
题意翻译
斯拉瓦玩他最喜欢的游戏“和平闪电”。现在,他在一张非常具体的地图上驾驶轰炸机。 map的形式是一个大小为1×n的棋盘格字段,其单元格的编号从1到n,每个单元格中可以有一个或多个坦克。斯拉瓦不知道坦克的数量和位置,因为他飞得很高,但他可以在任何牢房里投炸弹。这个格子里的所有坦克都会被损坏。 如果一个坦克第一次受到伤害,它会立即移动到相邻的一个单元(单元n中的坦克只能移动到单元n-1,单元1中的坦克只能移动到单元2)。如果一辆坦克第二次受到伤害,它将被视为被摧毁,再也不会移动。坦克只有在第一次被损坏时才会移动,它们不会自己移动。 帮助斯拉瓦摧毁所有坦克使用尽可能少的炸弹题目描述
Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map. 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. 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. Help Slava to destroy all tanks using as few bombs as possible.输入输出格式
输入格式
The first line contains a single integer $ n $ ( $ 2<=n<=100000 $ ) — the size of the map.
输出格式
In the first line print $ m $ — the minimum number of bombs Slava needs to destroy all tanks. 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} $ . If there are multiple answers, you can print any of them.
输入输出样例
输入样例 #1
2
输出样例 #1
3
2 1 2
输入样例 #2
3
输出样例 #2
4
2 1 3 2