Logo
(追記) (追記ここまで)

29777번 - Brought Down the Grading Server? 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB105171617.582%

문제

A hectic first competition day has passed… While the Scientific Committee narrowly fought off the hacking attack on the grading server, they fear that it affected the scoring of the submissions. There is only one option: all submissions have to be rejudged!

The grading server has $N$ processor cores. The committee has already assigned a list of $S$ submissions to each core, where each submission is to one of the $T$ tasks of the competition (numbered 1,ドル \dots , T$). The committee made sure that $S$ is a power of two.* Now, in the next $S$ minutes, each core will evaluate exactly one submission from its list per minute.

Unfortunately, the database containing the task data is quite fragile and could crash if the number of simultaneous requests for a single task’s data varies widely. Therefore, the committee wants to order the submissions of each core in such a way that, during the rejudging, the maximum and minimum number of simultaneously evaluated submissions for any single task differ by at most one.

Write a program which computes such an ordered assignment of the submissions to the cores.


* Due to a bug, the judging system would crash otherwise, taking down all firewalls and potentially exposing sensitive information!

You had one job, Wolfgang!

입력

The first line of input contains the three integers $N,ドル $S,ドル and $T$ described above.

Then, $N$ lines follow describing the submissions assigned to the cores. The $i$-th of these lines contains $S$ integers $t_1 , \dots , t_S$ (1ドル ≤ t_j ≤ T$), meaning that the $i$-th core is assigned submissions to the tasks $t_1 , \dots , t_S$ respectively.

출력

Your program should output $N$ lines that describe an ordered assignment of the submissions to the cores such that the maximum and minimum number of simultaneously evaluated submissions for any single task differ by at most one: The $i$-th of these lines should contain $S$ integers $r_1 , \dots , r_S,ドル meaning that the $i$-th core evaluates a submission to task $r_j$ during the $j$-th minute. It is guaranteed that such an assignment exists for each testcase.

제한

서브태스크

We always have that $S = 2^k$ for some positive integer $k,ドル 1ドル ≤ N, S, T ≤ 100,000円$ and $N \cdot S ≤ 500,000円$.

번호배점제한
110

$S = 2$ and $N, T ≤ 20$

225

$S = 2$

325

$N \cdot S ≤ 10,000円$

440

No further constraints.

예제 입력 1

3 2 3
1 2
2 3
2 3

예제 출력 1

2 1
3 2
2 3

예제 입력 2

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

예제 출력 2

2 2 2 3
3 2 3 2
2 3 2 2

힌트

In the output of the first example, the difference between the maximum and the minimum number of simultaneously evaluated submissions is one for tasks 1ドル$ and 2ドル$ and zero for task 3ドル$. On the other hand, ordering the submissions as in the input would not have constituted a valid output because the difference between the maximum and the minimum number of simultaneously evaluations submissions for task 3ドル$ is two.

In the output of the second example, the difference between the maximum and the minimum number of simultaneously evaluated submissions is zero for all three tasks.

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2023 > Day 1 3번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /