#B3827. Selecting Essential Exam Questions
Selecting Essential Exam Questions
Selecting Essential Exam Questions
Aya is responsible for selecting questions for the high‐stakes college entrance examination. He has n candidate questions. Each question is evaluated on k metrics (for example, difficulty, novelty, and real-life relevance), each given as a positive integer. The necessity of including a question is defined as the average of its k metrics, i.e. \(\frac{1}{k}\sum_{i=1}^{k} a_i\). The two questions with the highest necessity values must be included in the exam. In case of a tie in necessity, the question that appears earlier in the input is preferred.
Your task is to determine which two questions should be selected. Output the 1-indexed positions of the two chosen questions, with the one having the highest necessity first, followed by the second highest.
inputFormat
The input begins with a line containing two integers n and k (n ≥ 2), where n is the number of candidate questions and k is the number of metrics per question. Each of the next n lines contains k positive integers representing the metrics for that question.
outputFormat
Output two integers separated by a space: the 1-indexed positions of the questions that must be selected, with the question having the highest necessity value first and the second highest next.
sample
3 3
1 2 3
3 3 3
2 2 2
2 1