#P15852. [蓝桥杯第二届国际赛] 猜拳

    ID: 17922 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>模拟2018蓝桥杯国赛分类讨论

[蓝桥杯第二届国际赛] 猜拳

Problem Description

Alice, Bob, and Cindy are playing a game of rock-paper-scissors.

Similar to rock-paper-scissors played by two people, in each round, each of them chooses one move from rock, scissors, and paper. The basic winning rules are: rock beats scissors, scissors beats paper, and paper beats rock. If in a round the players can be split into a winning side and a losing side, then every player on the losing side must pay $1 to every player on the winning side. If the players cannot be split into a winning side and a losing side, then no one pays any money.

For example, if Alice plays rock, and Bob and Cindy both play paper, then Alice must pay Bob $1 and also pay Cindy $1.

For another example, if Alice plays rock, Bob plays scissors, and Cindy plays paper, then no one pays any money.

They played a total of nn rounds. Ask how much money each person earns in net in the end, i.e., earned money minus paid money.

Input Format

The first line contains an integer nn, meaning the game is played for a total of nn rounds.

The next nn lines each contain three integers, representing the moves played by Alice, Bob, and Cindy in one round. 00 means rock, 11 means scissors, and 22 means paper.

Output Format

Output three integers, one per line, representing the net money earned by Alice, Bob, and Cindy.

3
0 2 2
0 1 2
1 1 1
-2
1
1

Hint

Constraints

For all test cases, 1≤n≤1001 \leq n \leq 100.

Translated by ChatGPT 5