Who Won?
InterviewTime limit2sMemory limit1024 MB
Given two sets of 18 problem scores, decide who ranks higher by total, then by the count of 10s, 9s, and so on, or report a tie.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Statement
Algosia and Bajtek like to compete in Potyczki Algorytmiczne. The remote round has 18 problems, and each problem awards between 0 and 10 points. Contestants are ranked by their total score. If totals are tied, the contestant with more problems scored at 10 points ranks higher. If still tied, the contestant with more problems scored at 9 points ranks higher, and so on. If the contestants cannot be separated this way, they share a tied place.
Algosia and Bajtek remember their scores on every problem from the last edition, but they do not remember who placed higher. Write a program that reads their scores and reports which of them placed higher.
Input
The first line contains 18 integers from 0 to 10, the scores of Algosia on each problem in order.
The second line contains 18 integers from 0 to 10, the scores of Bajtek on each problem in order.
Output
Print one word on a single line: "Algosia" or "Bajtek", the name of the contestant who placed higher. If they tied, print "remis" instead of a name.
Hint
In the example, Algosia and Bajtek both have exactly 161 points. Under the rules of Potyczki Algorytmiczne, however, Algosia has the better result.