#P7203. [COCI 2019/2020 #3] Preokret
[COCI 2019/2020 #3] Preokret
Description
There are goals scored and their order is known. He wants to get the answers to the following questions:
-
What is the final score, i.e., the number of goals scored by City and by their opponent.
-
How many times during the match was the game tied, i.e., the two teams had the same number of goals. The initial score
0:0also counts as a tie. -
The largest “turnaround”. A “turnaround” means that one team, while being behind, scores consecutive goals and ends up leading the opponent. He wants to know how many goals that team scored in that consecutive run. The testdata guarantees that there is at least one “turnaround”.
Input Format
The first line contains the integer mentioned in the statement.
The next lines each contain an integer or . means City scores, and means their opponent scores.
Output Format
On the first line, output two integers separated by a space, representing the number of goals scored by City and by their opponent.
On the second line, output the number of ties.
On the third line, output the largest “turnaround”.
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
Hint
Sample Explanation
Explanation of the first sample:
The scores are: 0:0, 1:0, 2:0, 2:1, 2:2, 2:3. Among them, there are ties: 0:0 and 2:2. The largest “turnaround” is when City’s opponent was behind 2:0, but then scored more goals, making the score 2:3, and surpassed City.
Explanation of the second sample:
The scores are: 0:0, 1:0, 1:1, 1:2, 2:2, 3:2, 4:2, 4:3, 5:3, 6:3. Among them, there are ties: 0:0, 1:1, and 2:2. The largest “turnaround” is when City was behind 1:2, but then scored more goals, making the score 4:3, and surpassed the opponent.
Constraints
For of the testdata, .
Scoring
In this problem, each test point is scored by lines. The first line and the second line are both worth point, and the third line is worth points, so a Special Judge is used.
Notes
The scoring of this problem follows the original COCI problem setting, with a full score of .
This problem uses an unofficial Special Judge. You are welcome to hack it (via private message or by posting directly).
Translated from COCI2019-2020 CONTEST #3 T1 Preokret.
Translated by ChatGPT 5
京公网安备 11011102002149号