Super Dango Maker
시간 제한10초메모리 제한1024 MB
N*M개의 색깔 단고를 색이 겹치지 않는 N개씩 M개의 묶음으로 나누되, 검사기 질의를 50,000번 이하로 사용합니다.
문제
JOI-kun is a professional confectioner making dangos (Japanese dumplings). In JOI-kun’s shop, the colors of dangos are specified. There are colors of dangos, numbered from to .
A beautiful dango stick is a famous item in JOI-kun’s shop. A beautiful dango stick is made of dangos of different colors skewered with a stick.
For each of the colors, JOI-kun has dangos of that color. Therefore, JOI-kun has dangos in total. These dangos are numbered from to . Using these dangos and sticks, JOI-kun wants to make beautiful skewered dango sticks.
To avoid a mistake about the colors of the dangos, JOI-kun will use a dango checker. If JOI-kun inputs the indices of some dangos, the dango checker answers the maximum number of beautiful dango sticks he can make using the dangos in the input and sufficiently many sticks.
Using the dango checker several times, JOI-kun wants to divide the dangos into groups. Every group should consist of dangos, and contain a dango of each color.
JOI-kun wants to divide the dangos into groups using the dango checker at most times.
Write a program which, given information of the dangos, implements JOI-kun’s strategy to divide the dangos into groups using the the dango checker at most times.
제한
All input data satisfy the following constraints. For the values of , see Input for the Sample Grader.
- ().
- For each (), there are exactly indices () satisfying .
- , are integers.
- () is an integer.
예제
이 문제는 공개된 예제가 없습니다.