# 73. 测试用例执行计划
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputLines = [];
rl.on('line', function(line) {
inputLines.push(line);
});
rl.on('close', () => {
let [N, M] = inputLines.shift().split(' ').map(Number);
let f = inputLines.slice(0, N).map(Number);
let test = inputLines.slice(N).map((line, index) => {
let prioritySum = line.split(' ').reduce((sum, feature) => {
return sum + f[parseInt(feature) - 1];
}, 0)
return {id: index + 1, priority: prioritySum};
});
test.sort((a, b) => {
return b.priority - a.priority || a.id - b.id;
});
test.forEach(testCase => console.log(testCase.id));
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24