We Are Discuss About CODECHEF SOLUTION

Facebook Codechef Solution

Facebook Codechef Solution

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

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
JoinScishowEngineerTelegram

 

SOLUTION

Here Discuss About Facebook Codechef Solution

SOLUTION

Facebook Codechef Solution

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

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *