luogu#P7927. [COCI 2021/2022 #1] Ljeto

[COCI 2021/2022 #1] Ljeto

Problem Description

Two teams of four players, Pineapple and Blueberry, are playing with water guns.

We will be given nn pieces of information about the game. Each piece is in the form: at second tit_i, player aia_i hit player bib_i. For a player ii, if 1i41 \le i \le 4, then they are on Team Pineapple; otherwise, they are on Team Blueberry. Each hit adds 100100 points.

A “double spray” is defined as follows: within 1010 seconds, a player consecutively hits players from the opposing team. Suppose this player’s first hit happens at second tft_f. Then the second hit must happen within seconds [tf+1,tf+10][t_f + 1, t_f + 10]. Each double spray adds 5050 points to the team’s score, and double sprays can be triggered consecutively.

Find the scores of the two teams.

Input Format

The first line contains an integer nn.

The next nn lines each contain three integers ti,ai,bit_i, a_i, b_i.
It is guaranteed that all tit_i are distinct and are given in increasing order.

Output Format

Output one line with two integers, representing the scores of the two teams.

3
10 1 6
20 1 7
21 8 1

250 100
3
10 2 5
15 2 6
25 2 5
400 0
2
10 5 2
11 6 3
0 200

Hint

Constraints

For all testdata, 1n1001 \le n \le 100, 0ti1030 \le t_i \le 10^3, 1i<n,ti<ti+1\forall 1 \le i < n, t_i < t_{i+1}, 1ai,bi81 \le a_i, b_i \le 8, and player aia_i and player bib_i are not on the same team.

Subtask Special Constraints Points
11 n3n \le 3 1010
22 No double sprays exist 1515
33 No special constraints 2525

Notes

The total score of this problem is 5050 points.

This problem is translated from Croatian Open Competition in Informatics 2021/2022 Contest #1 T1 Ljeto.

Translated by ChatGPT 5