#P6853. station

station

Description

You need to design bus routes for a city.

There are a total of nn routes and mm stations. Both are numbered starting from 11.

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:

  1. A route cannot pass through only one station, so each route must pass through at least two stations.

  2. A station has limited capacity, so each station can be used by at most three routes.

  3. To keep traffic smooth, for any two different routes i,j(ij)i, j(i \not = j), there exists a third route k(ki,kj)k (k \not = i, k \not = j) such that kk is related to both ii and jj.

Given nn, find the minimum mm and output a specific plan.

Input Format

One line containing a positive integer nn, with the meaning as described in the statement.

Output Format

The first line outputs a positive integer mm, which is the number of stations used in your plan.

In the next nn lines, on the ii-th line output a positive integer cc and several positive integers a1,a2,,aca _1, a _2, \cdots, a _c, representing the number of stations passed by route ii 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 1,2,41, 2, 4. 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 33 together with routes 1,2,41, 2, 4 respectively. It is easy to verify that for any x{1,2,4}x \in \{1, 2, 4\}, there exists another route y{1,2,4},yxy \in \{1, 2, 4\}, y \not = x that is related to both 33 and xx, 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 00 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 [1,m][1, m].
  • Any of the three constraints in the statement is not satisfied.
  • The output file is too large, or mm is too large. If your mm is greater than 10610 ^6, you will directly receive 00 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 00 points, your score will be determined by the size of your mm.

For each test point, there are 1010 judging parameters w1,w2,,w10w _1, w _2, \cdots, w _{10}. If your output mm is less than or equal to kk of these parameters, then you will get k×10%k \times 10\% of the score for that test point.

These 1010 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): n10n \le 10. Here we guarantee that all 1010 scoring parameters are 10610 ^6.
  • Subtask 2 (40 points): n200n \le 200.
  • Subtask 3 (40 points): no special restrictions.

For all testdata, it holds that 3n4×1033 \le n \le 4 \times 10 ^3, and $ans + 5 \le w _1 \le w _2 \le \cdots \le w _{10} = 10 ^6$, where ansans denotes the standard answer.

Please note the condition w10=106w _{10} = 10^6.

Translated by ChatGPT 5