A16165 | Ten Words of Wisdom
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
In the game show "Ten Words of Wisdom", there are $n$ participants numbered from $1$ to $n$ , each of whom submits one response. The $i$ -th response is $a_i$ words long and has quality $b_i$ . No two responses have the same quality, and at least one response has length at most $10$ .
The winner of the show is the response which has the highest quality out of all responses that are not longer than $10$ words. Which response is the winner?
The winner of the show is the response which has the highest quality out of all responses that are not longer than $10$ words. Which response is the winner?
输入格式
The first line contains a single integer $t$ ( $1 \leq t \leq 100$ ) — the number of test cases.
The first line of each test case contains a single integer $n$ ( $1 \leq n \leq 50$ ) — the number of responses.
Then $n$ lines follow, the $i$ -th of which contains two integers $a_i$ and $b_i$ ( $1 \leq a_i, b_i \leq 50$ ) — the number of words and the quality of the $i$ -th response, respectively.
Additional constraints on the input: in each test case, at least one value of $i$ satisfies $a_i \leq 10$ , and all values of $b_i$ are distinct.
The first line of each test case contains a single integer $n$ ( $1 \leq n \leq 50$ ) — the number of responses.
Then $n$ lines follow, the $i$ -th of which contains two integers $a_i$ and $b_i$ ( $1 \leq a_i, b_i \leq 50$ ) — the number of words and the quality of the $i$ -th response, respectively.
Additional constraints on the input: in each test case, at least one value of $i$ satisfies $a_i \leq 10$ , and all values of $b_i$ are distinct.
输出格式
For each test case, output a single line containing one integer $x$ ( $1 \leq x \leq n$ ) — the winner of the show, according to the rules given in the statement.
It can be shown that, according to the constraints in the statement, exactly one winner exists for each test case.
It can be shown that, according to the constraints in the statement, exactly one winner exists for each test case.
输入输出样例
输入 #1
3 5 7 2 12 5 9 3 9 4 10 1 3 1 2 3 4 5 6 1 1 43
输出 #1
4 3 1
In the first test case, the responses provided are as follows:
- Response 1: $7$ words, quality $2$
- Response 2: $12$ words, quality $5$
- Response 3: $9$ words, quality $3$
- Response 4: $9$ words, quality $4$
- Response 5: $10$ words, quality $1$
We can see that the responses with indices $1$ , $3$ , $4$ , and $5$ have lengths not exceeding $10$ words. Out of these responses, the winner is the one with the highest quality.
Comparing the qualities, we find that:
- Response 1 has quality $2$ .
- Response 3 has quality $3$ .
- Response 4 has quality $4$ .
- Response 5 has quality $1$ .
Among these responses, Response 4 has the highest quality.
- Response 1: $7$ words, quality $2$
- Response 2: $12$ words, quality $5$
- Response 3: $9$ words, quality $3$
- Response 4: $9$ words, quality $4$
- Response 5: $10$ words, quality $1$
We can see that the responses with indices $1$ , $3$ , $4$ , and $5$ have lengths not exceeding $10$ words. Out of these responses, the winner is the one with the highest quality.
Comparing the qualities, we find that:
- Response 1 has quality $2$ .
- Response 3 has quality $3$ .
- Response 4 has quality $4$ .
- Response 5 has quality $1$ .
Among these responses, Response 4 has the highest quality.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted