#P6853. station
station
Description
You need to design bus routes for a city.
There are a total of routes and stations. Both are numbered starting from .
Your main task is to decide which stations each route should pass through. In other words, for each route, you may choose any subset of stations, and the route will pass through all stations in this subset.
Two routes are defined to be related if and only if they pass through at least one common station, i.e., their sets of stations intersect.
A route plan must satisfy the following constraints:
-
A route cannot pass through only one station, so each route must pass through at least two stations.
-
A station has limited capacity, so each station can be used by at most three routes.
-
To keep traffic smooth, for any two different routes , there exists a third route such that is related to both and .
Given , find the minimum and output a specific plan.
Input Format
One line containing a positive integer , with the meaning as described in the statement.
Output Format
The first line outputs a positive integer , which is the number of stations used in your plan.
In the next lines, on the -th line output a positive integer and several positive integers , representing the number of stations passed by route in your plan and the indices of those stations.
4
4
2 1 2
2 2 4
2 2 3
3 1 3 4
Hint
"Sample 1 Explanation"
As shown in the figure.

First, it is easy to see that it satisfies Conditions 1 and 2 in the statement. Now consider Condition 3.
First consider routes . You can see that these three routes form a triangle: for any two routes, the remaining one is related to both of them.
Then consider route together with routes respectively. It is easy to verify that for any , there exists another route that is related to both and , which satisfies the condition.
"Special Judge Notes and Scoring Rules"
Please read the output format carefully.
If your output has any of the following issues, you will receive points:
- The output format is incorrect, e.g., missing line breaks, printing strange characters, not printing the number of stations, etc.
- Some route passes through the same station more than once, or some station index is not within .
- Any of the three constraints in the statement is not satisfied.
- The output file is too large, or is too large. If your is greater than , you will directly receive points. If the output file is too large, it may cause TLE or OLE. It is recommended to keep the output size within 25 Mb.
If you are not judged as points, your score will be determined by the size of your .
For each test point, there are judging parameters . If your output is less than or equal to of these parameters, then you will get of the score for that test point.
These parameters are not publicly visible, meaning your program cannot know them during execution.
"Constraints"
This problem uses bundled testdata. Your score for a subtask is the minimum score among all test points in that subtask.
- Subtask 1 (20 points): . Here we guarantee that all scoring parameters are .
- Subtask 2 (40 points): .
- Subtask 3 (40 points): no special restrictions.
For all testdata, it holds that , and $ans + 5 \le w _1 \le w _2 \le \cdots \le w _{10} = 10 ^6$, where denotes the standard answer.
Please note the condition .
Translated by ChatGPT 5
京公网安备 11011102002149号