#P8545. 「Wdoi-2」不败的无尽兵团
「Wdoi-2」不败的无尽兵团
Background
The Beast Realm is an extreme world where the strong eat the weak, occupied by animal spirits, and also a world controlled by several organizations—the Strong Fang Group, the Ghostly Heroes Group, the Alliance of Animalistic Desire, and so on.
Among these animal spirits, there are also some spirits of primates, that is, human spirits. They are weak but nimble, and survive as complete slaves in an entertainment facility called the Primate Garden.
But human spirits also have faith. They prayed to the gods, and the gods responded, granting humans an idol of faith. However, at first the human spirits only worshiped the divinity behind the idol, but gradually they began to believe in the idol itself. As a result, naturally, the idol began to control humans, turning the Primate Garden into a vicious, out-of-control organization.
The Beast Realm also became chaotic because of the Primate Garden’s riot. In order to defeat the idol, the Ghostly Heroes Group hopes to involve the humans on the surface and use human hands to destroy the Primate Garden. So the animal spirits came to the surface, that is, Gensokyo, and led Reimu’s group to go to Hell together.
Problem Description
Brief statement
For a positive integer ( is or ), let . A family of subsets of is called good if, for every 3-element subset of , there exists exactly one such that is a subset of . Construct a good family of subsets such that is as small as possible (and does not exceed the scoring parameter given in the statement).
Original statement
Reimu, who went deeper into the Beast Realm, encountered the leader of the Haniwa legion, Taketou Ankuma Yumi, who blocked her way.
The Haniwa legion consists of warriors, numbered . The number of warriors is or . As a legion, to achieve the best offense and defense, there are groups of cooperation relations among the Haniwa, . Each group contains several distinct (but at least ) Haniwa warriors, but the same Haniwa warrior may appear in multiple different groups.
However, Reimu does not know these cooperation relations in advance, and because the Haniwa legion works together very well, it is hard for her to defeat them by force. With the help of the animal spirits, Reimu discovered that these Haniwa satisfy the following property: if you choose any Haniwa from the legion, there exists exactly one such that these three Haniwa are a subset of . Based on this property, since Ankuma Yumi has limited energy and cannot maintain too many cooperation groups at the same time, is a positive integer with , and it is also required that .
Now Reimu tells you the total number of warriors in the Haniwa legion. Please tell her one possible set of cooperation relations of the Haniwa legion to help her defeat Taketou Ankuma Yumi and enter the Primate Garden.
Input Format
The first line contains one positive integer , with the meaning described above. It is guaranteed that or .
Output Format
Output a positive integer in the first line, indicating the total number of sets used in your construction. It must satisfy .
Then output lines. Each line contains several integers. The first integer indicates the size of your constructed , which must satisfy . The next integers describe the elements in , separated by spaces.
4
4
3 1 2 3
3 1 2 4
3 1 3 4
3 2 3 4
5
7
4 1 2 3 4
3 1 2 5
3 1 3 5
3 1 4 5
3 2 3 5
3 2 4 5
3 3 4 5
Hint
Sample 1 explanation
The sample is only for understanding the statement. In the actual testdata, will only be or .
Since , the result cannot be . Also, because makes useless, the only solution is to list all 3-element subsets of , i.e. .
Constraints and notes
$$\def\arraystretch{1.5} \begin{array}{|c|c|c|c|}\hline \textbf{Subtask} & \bm{n=} & \bm{m_{\text{ans}}=} & \textbf{分值} \cr\hline 1 & 529 & 1.25\times 10^4 & 75 \cr\hline 2 & 625 & 1.60\times 10^4 & 25 \cr\hline \end{array}$$If your output solution is invalid, you will not get the score for that test point.
Only when your constructed solution satisfies the requirements, and the value of does not exceed , can you obtain the score for that test point.
Translated by ChatGPT 5