아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Super Dango Maker

시간 제한10초메모리 제한1024 MB

요약
N*M개의 색깔 단고를 색이 겹치지 않는 N개씩 M개의 묶음으로 나누되, 검사기 질의를 50,000번 이하로 사용합니다.
난이도

보통10점 중 7점

유형
그리디, 수학, 구현, 완전 탐색
정답자
아직 제출이 없습니다

문제

JOI-kun is a professional confectioner making dangos (Japanese dumplings). In JOI-kun’s shop, the colors of dangos are specified. There are NN colors of dangos, numbered from 11 to NN.

A beautiful dango stick is a famous item in JOI-kun’s shop. A beautiful dango stick is made of NN dangos of different colors skewered with a stick.

For each of the NN colors, JOI-kun has MM dangos of that color. Therefore, JOI-kun has N×MN × M dangos in total. These dangos are numbered from 11 to N×MN × M. Using these dangos and MM sticks, JOI-kun wants to make MM 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 N×MN × M dangos into MM groups. Every group should consist of NN dangos, and contain a dango of each color.

JOI-kun wants to divide the N×MN × M dangos into MM groups using the dango checker at most 50,00050\\,000 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 50,00050\\,000 times.

제한

All input data satisfy the following constraints. For the values of CC, see Input for the Sample Grader.

  • 1≤C_i≤N1 ≤ C\_i ≤ N (1≤i≤N×M1 ≤ i ≤ N × M).
  • For each jj (1≤j≤N1 ≤ j ≤ N), there are exactly MM indices ii (1≤i≤N×M1 ≤ i ≤ N × M) satisfying C_i=jC\_i = j.
  • NN, MM are integers.
  • C_iC\_i (1≤i≤N×M1 ≤ i ≤ N × M) is an integer.

예제

이 문제는 공개된 예제가 없습니다.