TCS Examination solution codechef
Two friends, Dragon and Sloth, are writing a computer science examination series. There are three subjects in this series:, , and . Each subject carries marks.
You know the individual scores of both Dragon and Sloth in allsubjects. You have to determine who got a better rank.
The rank is decided as follows:
- The person with a bigger total score gets a better rank
- If the total scores are tied, the person who scored higher in gets a better rank
- If the total score and the score are tied, the person who scored higher in gets a better rank
- If everything is tied, they get the same rank.
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains three space-separated integers denoting the scores of Dragon in , and respectively.
- The second line of each test case contains three space-separated integers denoting the scores of Sloth in , and respectively.
- For each test case, if Dragon got a better rank then output
"Dragon", else if Sloth got a better rank then output
"Sloth". If there was a tie then output
"Tie". Note that the string you output should not contain quotes.
- The output is case insensitive. For example, If the output is “Tie” then “TiE”, “tiE”, “tie”, etc are also considered correct.
- Each score of both Dragon and Sloth lies between and .
Subtask #1 (100 points): Original constraints
Sample Input 1
4 10 20 30 30 20 10 5 23 87 5 23 87 0 15 100 100 5 5 50 50 50 50 49 51
Sample Output 1
SLOTH TIE DRAGON DRAGON
- For the first test case, Sloth and Dragon have the same total score but Sloth gets a better rank because he has a higher score in .
- For the second test case, Sloth and Dragon have the same rank because they have the same score among all subjects.
- For the third test case, Dragon gets a better rank because he has a greater total score.
- For the fourth test case, Sloth and Dragon have the same total score and same score. Dragon gets a better rank because he has a greater score.