Woburn Challenge 2017-18 Round 1 - Junior Division
Problem 3: Stanley
This is it – the exciting finals of the Stanley Cup playoffs are about to begin! The format is a best-of-7 series, in which the first team to win 4 games will claim the Cup!
In each game, the team which scores more points than the other team wins (there are no ties). The series ends as soon as one team has won 4 games, and no further games are played after that point. This means that the series may last between 4 and 7 games, inclusive.
By collecting data on all hockey games which have ever been played, and performing some sophisticated data analysis, you've managed to predict all of the upcoming games' scores with absolute certainty. You know that, in the i-th game, Team A will score Ai points and Team B will scores Bi points (0 ≤ Ai, Bi ≤ 10, Ai ≠ Bi). In fact, you have these values for all 7 potential games in the series, even though the 5th, 6th, and/or 7th games may not actually get played, in which case their scores should be ignored.
All that's left is to place your bets on the winning team. You can rake in even more cash if you bet on the exact final game counts. As such, given your predicted scores, determine the number of games won by each of the teams when the series ends.
The input consists of seven lines, the i-th of which consists of two space-separated integers, Ai and Bi (for i = 1..7).
Output two space-separated integers, the number of games won by Teams A and B respectively when the series ends.
5 3 4 1 1 5 1 4 0 6 0 2 3 1
After the 6th game, Team A has won 2 games (games 1 and 2), while Team B has won the remaining 4 (games 3, 4, 5, and 6). Because Team B has just reached a total of 4 games won, the series ends. Note that the potential scores for game 7 are included in the input, but aren't considered because that game doesn't end up getting played.
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Jan 26, 2018
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3