8980: The Game of Eating

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Today, Fallleaves01 and his n−1n-1n1 friends went out for dinner. They intend to order a total of kkk dishes. To ensure everyone gets their favorite dish, they decided to take turns ordering one dish each in sequential order(i.e., 1st person, 2nd person, ..., nnn-th person, 1st person, ...) and repeat until they have ordered a total of kkk dishes.

Please be aware that the dishes ordered by one person can be shared and tasted by everyone. To ensure a wide variety of flavors and experiences, it is important for individuals to avoid ordering the same dish multiple times.

There are a total of mmm dishes available for selection. Everyone knows each person's preferences for every dish. This information is represented by an n×mn\times mn×m matrix called AAA, where Ai,jA_{i,j}Ai,j denotes the degree to which the iii-th person likes the jjj-th dish.

Assume that each person only cares about their own enjoyment of the dishes without considering others. In other words,if they ultimately choose dishes p1,p2...,pkp_1,p_2..., p_kp1,p2...,pk, person iii aims to maximize ∑1≤j≤kAi,pj\sum_{1 \leq j \leq k} A_{i,p_j}1jkAi,pj.

We also found that for every different 1≤x,y≤m,Ai,x≠Ai,y1 \leq x,y \leq m, A_{i,x} \neq A_{i,y}1x,ym,Ai,x=Ai,y.

Fallleaves01 is curious to know what dishes will be on the table if everyone makes optimal decisions.

输入格式

The input consists of multiple test cases. The first line of each test case contains an integer ttt, indicating the number of test cases. The following lines describe each test case.
For each test case, the first line contains three integers nnn, mmm, and kkk (1≤n≤2000,1≤k≤m≤20001 \leq n \leq 2000, 1 \leq k \le m \leq 20001n2000,1km2000). These represent the number of people, the number of dishes, and the number of dishes planned to be ordered, respectively.
The next nnn lines contain mmm integers per line. The jjj-th number on the iii-th line represents the degree to which the iii-th person likes the jjj-th dish, denoted as Ai,jA_{i,j}Ai,j (1≤Ai,j≤1091 \leq A_{i,j} \leq 10^91Ai,j109).
It is guaranteed that the sum of nnn and the sum of mmm do not exceed 200020002000.

输出格式


For each test case, output a row of kkk integers in increasing order, representing the final selected dishes.

输入样例 复制

3
3 4 2
3 2 1 4
3 1 2 4
1 2 3 4
3 4 3
1 2 3 4
3 1 2 4
1 3 2 4
3 20 10
12 25 24 2 23 1 7 17 10 13 9 4 30 29 11 20 14 27 19 18
9 1 22 26 15 16 11 29 18 24 3 21 25 6 19 7 14 13 17 28
26 27 16 2 17 20 12 4 3 1 24 19 9 28 8 18 15 29 13 22

输出样例 复制

1 4
1 3 4
1 2 3 4 5 8 13 14 18 20

分类标签