We Lost Again Today
InterviewTime limit1sMemory limit64 MB
Given the runs each team scored in all nine innings, decide whether the Ullim Geminis ever held a lead during a game they ended up losing.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation, Array
- Solved
- No attempts yet
Problem
The baseball team Ullim Geminis lost again today. This time the cleanup hitter of the Galaxy Gullivers ended the game with a walk off home run. Jisoo, a devoted Ullim Geminis fan, swallowed her anger and worked out who was to blame. She thinks that if the team blew a lead and lost, the bullpen pitchers are responsible, and if it did not, the batters and the starting pitcher are.
Help Jisoo and write a program that decides whether today's game was a blown lead. A blown lead requires that at some moment during the game the Ullim Geminis were ahead.
Input
The first line has 9 integers, the runs the Ullim Geminis scored in the top of the 1st inning, the top of the 2nd inning, ..., the top of the 9th inning.
The second line has 9 integers, the runs the Galaxy Gullivers scored in the bottom of the 1st inning, the bottom of the 2nd inning, ..., the bottom of the 9th inning.
The runs one team scores in one half inning are between 0 and 20, and the total of the Galaxy Gullivers is larger than the total of the Ullim Geminis.
The game runs in the order top of the 1st, bottom of the 1st, top of the 2nd, ..., top of the 9th, bottom of the 9th.
Output
Print Yes if the Ullim Geminis blew a lead and lost. Otherwise print No.
Hint
Runs go up one at a time, and a tied score is not a lead. In the first example the Ullim Geminis were ahead from the moment they scored their run in the top of the 1st inning to the moment the Galaxy Gullivers scored their first run in the bottom of the 3rd inning, and from the moment they scored their first run in the top of the 8th inning to the moment the Galaxy Gullivers scored their second run in the bottom of the 9th inning.