RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00541

Preokret

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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
1. What was the final score, i.e., how many goals did City score and how many goals did their opponents
score?
2. How many different ties were featured during the course of the game? We say that the game is tied
if both teams have scored the same number of goals. The starting score 0:0 is also considered a tie.
3. Let’s define a turnover as a situation in which a losing team, i.e. the team that scored less goals
than its opponent, scores a certain number of successive goals and takes the lead after those goals
have been scored. Pep wonders what is the largest turnover in the game. In other words, he wants
to know what was the largest number of successive goals scored by one team such that before those
goals they were losing and after those goals they were winning. Pep knows that this specific game
had at least one turnover.

제약

In this task, each line of output is graded separately. The correct output in the first line is worth 1 point
in each test case. The correct output in the second line is also worth 1 point in each test case. The correct
output in the third line is worth 3 points in each test case.

입력 형식

First line contains an integer \(N\) (\(1 \le N \le 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 spa\(ce-se\)parated 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.

예제 1
입력
5
1
1
2
2
2
출력
2 3
2
3
예제 2
입력
9
1
2
2
1
1
1
2
1
1
출력
6 3
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.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2019/2020 Contest 3

평가 및 의견

Preokret

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Preokret

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8