CF1622E.Math Test
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petya is a math teacher. n of his students has written a test consisting of m questions. For each student, it is known which questions he has answered correctly and which he has not.
If the student answers the j-th question correctly, he gets pj points (otherwise, he gets 0 points). Moreover, the points for the questions are distributed in such a way that the array p is a permutation of numbers from 1 to m.
For the i-th student, Petya knows that he expects to get xi points for the test. Petya wonders how unexpected the results could be. Petya believes that the surprise value of the results for students is equal to i=1∑n∣xi−ri∣, where ri is the number of points that the i-th student has got for the test.
Your task is to help Petya find such a permutation p for which the surprise value of the results is maximum possible. If there are multiple answers, print any of them.
佩佳是一名数学老师。他的 n 名学生参加了一场包含 m 道题的测验。对于每名学生,已知他哪些题目答对、哪些题目答错。
若某学生正确回答了第 j 道题,则他获得 pj 分(否则得 0 分)。此外,各题分值按如下方式分配:数组 p 是 1 到 m 这些整数的一个排列。
对于第 i 名学生,佩佳知道他预期在本次测验中获得 xi 分。佩佳想知道实际结果可能有多“出人意料”。佩佳定义学生们的“意外值”为 i=1∑n∣xi−ri∣,其中 ri 表示第 i 名学生实际获得的分数。
你的任务是帮助佩佳找出一个排列 p,使得结果的意外值尽可能大。如有多个满足条件的答案,输出任意一个即可。
输入格式
The first line contains a single integer t (1≤t≤104) — the number of test cases.
The first line of each test case contains two integers n and m (1≤n≤10; 1≤m≤104) — the number of students and the number of questions, respectively.
The second line contains n integers x1,x2,…,xn (0≤xi≤2m(m+1)), where xi is the number of points that the i-th student expects to get.
This is followed by n lines, the i-th line contains the string si (∣si∣=m;si,j∈0,1), where si,j is 1 if the i-th student has answered the j-th question correctly, and 0 otherwise.
The sum of m for all test cases does not exceed 104.
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。
每个测试用例的第一行包含两个整数 n 和 m(1≤n≤10;1≤m≤104)—— 分别表示学生人数和题目数量。
第二行包含 n 个整数 x1,x2,…,xn(0≤xi≤2m(m+1)),其中 xi 表示第 i 个学生预期获得的分数。
接下来是 n 行,第 i 行包含一个字符串 si(∣si∣=m;si,j∈{0,1}),其中 si,j 为 1 表示第 i 个学生正确回答了第 j 道题,为 0 则表示回答错误。
所有测试用例的 m 值之和不超过 104。
输出格式
For each test case, print m integers — a permutation p for which the surprise value of the results is maximum possible. If there are multiple answers, print any of them.
对于每个测试用例,输出 m 个整数——一个使得结果的“惊喜值”达到最大可能值的排列 p。如果存在多个答案,输出其中任意一个即可。
输入输出样例
输入#1
3 4 3 5 1 2 2 110 100 101 100 4 4 6 2 0 10 1001 0010 0110 0101 3 6 20 3 15 010110 000101 111111
输出#1
3 1 2 2 3 4 1 3 1 4 5 2 6
输入解题思路,AI测评打分。不知道怎么写?