luogu#P4960. 血小板与凝血因子

血小板与凝血因子

Background

To repair the wound as soon as possible, the platelets are carrying coagulation factors. They (nothing wrong) are discussing how to distribute them. Since they are so cute, you are asked to solve this problem.

Problem Description

The platelets have two different types of containers. In the first type, each container can hold only one kind of coagulation factor. In the second type, in each container, each kind of coagulation factor can appear at most once. For convenience, the platelets want to use only one type of container to hold all coagulation factors.

In other words, partition nn positive integers a1a_1 ~ ana_n into some disjoint sets S1S_1 ~ SmS_m, satisfying one of the following two conditions:

  1. ai, ajSk, k[1, m]\forall a_i,\ a_j\in S_k,\ k\in [1,\ m], we have ai=aja_i=a_j.
  2. ai, ajSk, k[1, m], ij\forall a_i,\ a_j\in S_k,\ k\in [1,\ m],\ i\neq j, we have aiaja_i\neq a_j.

Since there are not many platelets, you need to put all coagulation factors into as few containers as possible. They want to know how to partition them so that the total number of containers is minimized.

Input Format

The first line contains a positive integer nn, the number of coagulation factors.

The second line contains nn positive integers aia_i, each representing the type of a coagulation factor.

Output Format

The first line contains two positive integers. The first is the minimum number of containers mm, and the second is the type of container used (11 or 22).

In the next mm lines, in each line, the first positive integer cic_i represents the number of coagulation factors in this container, followed by cic_i integers representing the type of each coagulation factor in this container.

Output any valid optimal solution. The output order does not matter.

7
1 2 3 5 4 4 4
3 2
1 4
5 3 1 2 4 5
1 4
3
20181110 20181111 20181111
2 1
1 20181110
2 20181111 20181111
3
20181110 20181111 20181111
2 2
2 20181110 20181111
1 20181111
5
3 2 3 2 3
2 1
3 3 3 3
2 2 2

Hint

Constraints: 1n1000,  1ai1091\le n\le 1000,\ \ 1\le a_i\le 10^9

Input Format

Output Format

Hint

Translated by ChatGPT 5