Skip to content
neoideasblog

neoideasblog

  • Home
    • Privacy Policy
    • About Us
    • Contact Us
    • Terms
  • Trivia
  • Results
  • Admit Cards
  • Sitemaps
  • Toggle search form

Determine the Winner solution codechef-

Posted on June 1, 2022June 1, 2022 By Admin No Comments on Determine the Winner solution codechef-

There is a contest containing 22 problems AA and BB.

22 strong participants PP and QQ participated in the contest and solved both the problems.

Determine the Winner solution codechef

There is a contest containing 22 problems AA and BB.

22 strong participants PP and QQ participated in the contest and solved both the problems.

PP made AC submissions on problems AA and BB at time instants PAPA and PBPB respectively while QQ made AC submissions on problems AA and BB at time instants QAQA and QBQB.

It is given that the time penalty is the minimum time instant at which a participant has solved both the problems. Also the participant with the lower time penalty will have a better rank.

ALSO READ:-   [Question] 2. If I described my friend as being tighter than two coats of paint, what would I be implying?

Determine which participant got the better rank or if there is a TIE.

Determine the Winner solution codechef 

Input Format

  • The first line will contain TT, number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, four integers PA,PB,QA,QBPA,PB,QA,QB.

Output Format

For each test case, output P if PP got a better rank, Q if QQ got a better rank, TIE otherwise.

ALSO READ:-   [Question] Before the "National Basketball Association," what was the league called?

Note that output is case-insensitive i.e. P and p both are considered the same.

Constraints

Determine the Winner solution codechef

  • 1≤T≤10001≤T≤1000
  • 1≤PA,PB,QA,QB≤1001≤PA,PB,QA,QB≤100

Sample Input 1 

4
5 10 2 12
10 30 15 15
20 8 4 20
6 6 6 6

Sample Output 1 

P
Q
TIE
TIE

Explanation

Determine the Winner solution codechef

Test Case 11:

  • Time penalty incurred by participant P=10P=10.
  • Time penalty incurred by participant Q=12Q=12.

Since 10<1210<12, PP gets a better rank.

Test Case 22:

  • Time penalty incurred by participant P=30P=30.
  • Time penalty incurred by participant Q=15Q=15.
ALSO READ:-   [Question] What is considered the first modern novel?

Since 15<3015<30, QQ gets a better rank.

Test Case 33:

  • Time penalty incurred by participant P=20P=20.
  • Time penalty incurred by participant Q=20Q=20.

Since 20=2020=20, PP and QQ gets a same rank (TIE).

Test Case 44:

  • Time penalty incurred by participant P=6P=6.
  • Time penalty incurred by participant Q=6Q=6.

Since 6=66=6, PP and QQ gets a same rank (TIE).

SOLUTION

“Click Here“

Admin

I am the Founder and the creator of the blog neoideasblog.com where we share latest trivia questions and answers on a daily basis.

Trivia

Post navigation

Previous Post: Chef and Chocolates solution codechef- Chef has XX 5 rupee coins and YY 10 rupee coins. Chef goes to a shop to buy chocolates for Chefina where each chocolate costs ZZ rupees. Find the maximum number of chocolates that Chef can buy for Chefina.
Next Post: Equal Integers solution codechef- Chef has two integers XX and YY. Chef wants to perform some operations to make XX and YY equal. In one operation, Chef can either:

Related Posts

[Question] 1. Dickens’ death in 1870 left his last novel unfinished. What is the title? Trivia
[Question] What is a synonym for “scion”? Trivia
[Question] What continent is home to the largest land animal in the world? Trivia
In 1945, Indonesia declared its independence from what country? Trivia
[Question] Who Painted “The Creation Of Man”? Trivia
[Question] Which state flag bears the arms of two European families? Trivia

Leave a Reply Cancel reply

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

Archives

  • June 2022
  • May 2022
  • April 2022

Categories

  • Admit Cards
  • Results
  • Trivia

Disclaimer

Disclaimer: Our website name Neoideasblog.com. we are just a news portal that covers various updates and stories.

Copyright © 2022 neoideasblog.

Powered by PressBook Grid Blogs theme