302758: CF534A. Exam
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Exam
题意翻译
现在要在一个狭长的教室中举办一场考试,所以学生们会坐成一列,而老师怀疑编号相邻的两个人(i,i+1)会一起学习,并且成为朋友,这样他们就会在考试时进行文化交流学习借鉴(作弊) 你的任务就是选出最大数量的学生,并且使相邻的两个同学编号不相邻题目描述
An exam for $ n $ students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers ( $ i $ and $ i+1 $ ) always studied side by side and became friends and if they take an exam sitting next to each other, they will help each other for sure. Your task is to choose the maximum number of students and make such an arrangement of students in the room that no two students with adjacent numbers sit side by side.输入输出格式
输入格式
A single line contains integer $ n $ ( $ 1<=n<=5000 $ ) — the number of students at an exam.
输出格式
In the first line print integer $ k $ — the maximum number of students who can be seated so that no two students with adjacent numbers sit next to each other. In the second line print $ k $ distinct integers $ a_{1},a_{2},...,a_{k} $ ( $ 1<=a_{i}<=n $ ), where $ a_{i} $ is the number of the student on the $ i $ -th position. The students on adjacent positions mustn't have adjacent numbers. Formally, the following should be true: $ |a_{i}-a_{i+1}|≠1 $ for all $ i $ from $ 1 $ to $ k-1 $ . If there are several possible answers, output any of them.
输入输出样例
输入样例 #1
6
输出样例 #1
6
1 5 3 6 2 4
输入样例 #2
3
输出样例 #2
2
1 3