시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 70 | 35 | 31 | 52.542% |
It’s Saint Stephen’s Day, the day after Christmas. The secular version of the same holiday in England is known as Boxing day. While people in Croatia celebrate Saint Stephen’s Day by stuffing themselves with ridiculous amounts of food, our British friends traditionally play football. Premier league, Championship, amateur leagues – everybody plays football on Boxing day.
This year, Pep ate too much roast beef on Christmas and decided to take a break from Boxing day football. He stayed in bed that day, analyzing an old City fixture against an unknown opponent.
Pep knows that there were N goals scored during the match and he also knows in which order were they scored. He watches the game and wishes to answer the following questions
First line contains an integer N (1 ≤ N ≤ 250) from the task description.
In the next N lines there is a single number 1 or 2 which represents a team that scored a goal (in order of goals scored in the game). City is denoted by number 1 and their opponents by number 2.
In the first line you should output two space-separated integers, the number of goals scored by City and the number of goals scored by the opposing team.
In the second line you should output the number of different ties featured during the course of the game.
In the third line you should output the largest turnover in the game.
5 1 1 2 2 2
2 3 2 3
9 1 2 2 1 1 1 2 1 1
6 3 3 3
3 2 1 1
2 1 2 2
Explanation of the first example: Different scores during the game were: 0:0, 1:0, 2:0, 2:1, 2:2, 2:3. Out of those, there were two ties: 0:0 and 2:2. The largest turnover happened when the opposing team were losing 2:0 and then scored three successive goals, thereby winning 2:3.
Explanation of the second example: Different scores during the game were: 0:0, 1:0, 1:1, 1:2, 2:2, 3:2, 4:2, 4:3, 5:3, 6:3. Out of those, there were three ties: 0:0, 1:1 and 2:2. The largest turnover happened when City were losing 1:2 and then scored three successive goals and started winning 4:2.