#P5823. 【L&K R-03】课表的排列
【L&K R-03】课表的排列
Description
Today’s timetable is:
Chinese Math English Chinese English Math
There are three subjects on today’s timetable: Chinese, Math, and English. Each subject has two classes. For each subject, the number of classes between its two occurrences is . After sorting these numbers from small to large, we get , which is an arithmetic sequence with common difference .
Little L wants to know whether a timetable with the same interesting property exists for more subjects. In other words, if there are subjects on the timetable, and each subject appears exactly twice, Little L wants to know whether there exists a timetable such that, after sorting the numbers of classes between the two classes of each of the subjects from small to large, the result is an arithmetic sequence with common difference .
However, Little L can only write an algorithm with time complexity , so he asks you for help. You need to determine whether such a timetable exists. If it exists, you also need to output one possible timetable.
Input Format
The input contains only one line: an odd integer , representing the number of subjects on the timetable.
Output Format
Output only one line.
If no such timetable exists, output -1.
If such a timetable exists, output integers representing the timetable. Let each integer in correspond to one subject. Each integer appears exactly twice in the timetable, and the timetable must satisfy Little L’s property. Since there may be multiple valid answers, you may output any one. Little K, who has just arrived at the classroom, will write a program to check whether your timetable satisfies Little L’s property.
3
1 2 3 1 3 2
Hint
This problem uses Special Judge.
There are test points in total, and each test point is worth points.
| Data Index | |
|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号