#P7927. Water Gun Scoring

    ID: 21112 Type: Default 1000ms 256MiB

Water Gun Scoring

Water Gun Scoring

Two teams of four players each, Pineapple (players 1-4) and Blueberry (players 5-8), are playing a water gun game.

You are given n pieces of information. Each piece of information is of the form: at time \(t_i\) seconds, player \(a_i\) hit player \(b_i\). When a player hits an opposing team member, their team gets 100 points.

In addition, a double spray is defined as follows: when a player hits an opponent, if his next hit occurs within \([t_f+1, t_f+10]\) seconds (where \(t_f\) is the time of his first hit), then his team earns an additional 50 points. This bonus can be chained: every consecutive hit within 10 seconds of the previous hit (by the same player) earns an extra 50 points.

Calculate the final scores of both teams.

inputFormat

The first line contains an integer (n), the number of events. Each of the next (n) lines contains three integers (t), (a), and (b) representing that at time (t) seconds, player (a) hit player (b). It is guaranteed that each hit is from a player in one team to a player in the opposing team.

outputFormat

Output two integers separated by a space: the score of team Pineapple and the score of team Blueberry.

sample

3
1 1 5
5 1 6
20 7 3
250 100