eolymp
bolt
Try our new interface for solving problems
Problems

Summer

Summer

Bruno and his friends are playing with water guns. They are passionate gamers, which is why this is not a regular water gun game, but is in fact very similar to video-games. They even hired a moderator for the game. At the beginning of the game, the players are divided into two teams: pineapples and blueberries. During the game, the moderator keeps track of every time some player sprays some other player, writing down the time when it happened. Just like in video-games, the players acquire points. When a player from some team sprays someone from the opposing team, their team receives $100$ points. However, if within $10$ seconds the same player again sprays someone from the opposing team, this is counted as a double-spray and their team receives an additional $50$ points. A player can achieve multiple double-sprays in a row, each worth an additional $50$ points for their team \InputFile The first line contains the integer $n~(1 \le n \le 100)$, the number of sprays that happened during the game. Each of the following $n$ lines contains three integers $t_i$, $a_i$, $b_i~(0 \le t_i \le 1000, 1 \le a_i, b_i \le 8)$ which denote that player $a_i$ sprayed player $b_i$ at time $t_i$ (in seconds). Labels of the players from team pineapple are positive integers from $1$ to $4$, while the labels of the players from team blueberry are the positive integers from $5$ to $8$. The players $a_i$ and $b_i$ are guranteed to be from different teams. The numbers $t_i$ are distinct and are ordered increasingly. \OutputFile One line contains two numbers: the total score of team pineapple and the total score of team blueberry. \Examples In the first example at seconds $10$ and $20$ player $1$ sprayed players $6$ and $7$ from the other team. For each spraying the pineapples received $100$ points. As the sprays happened within $10$ seconds, the team receieved an additional $50$ poitns $(250 = 2 \cdot 100 + 50)$. Team blueberries sprayed only one player from the opposing team, which is why they received only $100$ points. For the second example player $2$ achieved two double-sprays in a row, which is why team pineapple got a total of $3 \cdot 100 + 2 \cdot 50 = 400$ points.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
10 1 6
20 1 7
21 8 1
Output example #1
250 100
Input example #2
3
10 2 5
15 2 6
25 2 5
Output example #2
400 0
Input example #3
2
10 5 2
11 6 3
Output example #3
0 200
Source 2021 COCI Croatian Open Competition In Informatics, Round 1, October 16