# Facebook Codechef Solution

## Facebook Codechef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, SoĀ JOIN NOW

## Problem

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Ā ļæ½Ā andĀ ļæ½, each having sizeĀ ļæ½, such that the number of likes and comments on theĀ ļæ½ļæ½āĀ post areĀ ļæ½ļæ½Ā andĀ ļæ½ļæ½Ā 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Ā ļæ½, 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Ā ļæ½, the number of posts.
• The second line of each test case containsĀ ļæ½Ā space-separated integersĀ ļæ½1,ļæ½2,ā¦,ļæ½ļæ½Ā ā whereĀ ļæ½ļæ½Ā is the number of likes on theĀ ļæ½ļæ½āĀ post.
• The third line of each test case containsĀ ļæ½Ā space-separated integersĀ ļæ½1,ļæ½2,ā¦,ļæ½ļæ½Ā ā whereĀ ļæ½ļæ½Ā is the number of comments on theĀ ļæ½ļæ½āĀ post.

### Output Format

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

### Constraints

• 1ā¤ļæ½ā¤1000
• 1ā¤ļæ½ā¤105
• 1ā¤ļæ½ļæ½,ļæ½ļæ½ā¤2ā105
• The elements of arrayĀ ļæ½Ā are distinct.
• It is guaranteed that the sum ofĀ ļæ½Ā over all test case does not exceedĀ 2ā105.

### Sample 1:

Input

Output

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


### Explanation:

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.

Answers will be Uploaded Shortly and it will be Notified on Telegram, SoĀ JOIN NOW

## SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit HereĀ ScishowEngineerĀ Ā  ThenĀ Follow US HEREĀ andĀ Join Telegram.

If You Want To Learn Something New Then Visit OurĀ Official Channel YOUTUBE