Problem A
Wake up call
Waking up in the morning is hard. Especially when you can snooze the alarm clock. To be able to wake up, Tyko has built an alarm clock that generates 2 sequences of numbers. Related to each sequence, there is a button, and to snooze the clock, Tyko has to press the button for which the sum over the sequence is the greatest. However, sometimes in rare cases, the sequences have the same sum, and then no button snoozes the clock. Tyko was a bit optimistic of how fast he was able to sum up in the morning, so now he doesn’t want to do it manually. Write him a program to find which button to press. If no button turns off the clock, then say "Oh no".
Input
The first line of input contains 2 integers $1 \leq N, M \leq 2 \cdot 10^5$, the number of numbers in the first sequence and the second sequence.
The second line contains $N$ space-separated integers $\{ s_0, s_1, \cdots , s_{N-1}\} $, $|s_i| \leq 10^4$.
The third line contains $M$ space-separated integers $\{ s_0, s_1, \cdots , s_{M-1}\} $, $|s_i| \leq 10^4$.
Output
Output a single line with "Button 1" if the first sequence has a bigger sum, "Button 2" if the second sequence has a bigger sum. If the 2 sequences have the same sum then output "Oh no".
Sample Input 1 | Sample Output 1 |
---|---|
2 3 5 10 5 4 3 |
Button 1 |
Sample Input 2 | Sample Output 2 |
---|---|
3 2 5 4 3 5 10 |
Button 2 |
Sample Input 3 | Sample Output 3 |
---|---|
5 5 10 17 3 8 3 3 9 15 6 8 |
Oh no |