P16468 [CodeChef] FACEBOOK
普及-
题目描述

A post on facebook is said to be more popular if the number of likes on the post is strictly greater than the number of likes on some other post. In case the number of likes is same, the post having more comments is more popular.

Given arrays A and B, each having size N, such that the number of likes and comments on the i^{th} post are A_{i} and B_{i} respectively, find out which post is most popular.

It is guaranteed that the number of comments on all the posts is distinct.

------ Input Format ------

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of multiple lines of input.
  • The first line of each test case contains a single integer N, the number of posts.
  • The second line of each test case contains $N space-separated integers A_{1}, A_{2}, \ldots, A_{N}$ — where A_{i} is the number of likes on the i^{th} post.
  • The third line of each test case contains $N space-separated integers B_{1}, B_{2}, \ldots, B_{N}$ — where B_{i} is the number of comments on the i^{th} post.

------ Output Format ------

For each test case, output on a new line, an integer in the range 1 to N, denoting the index of the post which is most popular among the N posts.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 10^{5}$
$1 ≤ A_{i}, B_{i} ≤ 2\cdot 10^{5}$
- The elements of array $B$ are distinct.
- It is guaranteed that the sum of $N$ over all test case does not exceed $2\cdot 10^{5}$.

----- Sample Input 1 ------
4
3
5 4 4
1 2 3
3
10 10 9
2 5 4
3
3 3 9
9 1 3
4
2 8 1 5
2 8 1 9

----- Sample Output 1 ------
1
2
3
2

----- explanation 1 ------
Test case $1$: The number of likes on the first post is greater than that of second and third post. Thus, the first post is most popular.

Test case $2$: The first and second post have maximum number of likes. But, the second post has more comments than the first post. Thus, the second post is most popular.

Test case $3$: The number of likes on the third post is greater than that of first and second post. Thus, the third post is most popular.

Test case $4$: The number of likes on the second post is greater than that of first, third, and fourth post. Thus, the second post is most popular.

输入格式

见题面

输出格式

见题面

样例输入
4 3 5 4 4 1 2 3 3 10 10 9 2 5 4 3 3 3 9 9 1 3 4 2 8 1 5 2 8 1 9
样例输出
1 2 3 2