Hoof, Paper, Scissors
의견: 0
You have probably heard of the game "Rock, Paper, Scissors". The cows like to
play a similar game they call "Hoof, Paper, Scissors".
The rules of "Hoof, Paper, Scissors" are simple. Two cows play against
each-other. They both count to three and then each simultaneously makes a
gesture that represents either a hoof, a piece of paper, or a pair of scissors.
Hoof beats scissors (since a hoof can smash a pair of scissors), scissors beats
paper (since scissors can cut paper), and paper beats hoof (since the hoof can
get a papercut). For example, if the first cow makes a "hoof" gesture and the
second a "paper" gesture, then the second cow wins. Of course, it is also
possible to tie, if both cows make the same gesture.
Farmer John watches in fascination as two of his cows play a series of \(N\)
games of "Hoof, Paper, Scissors" (\(1 \leq N \leq 100\)). Unfortunately, while
he can see that the cows are making three distinct types of gestures, he can't
tell which one represents "hoof", which one represents "paper" and which one
represents "scissors" (to Farmer John's untrained eye, they all seem to be
variations on "hoof"...)
Not knowing the meaning of the three gestures, Farmer John assigns them numbers
1, 2, and 3. Perhaps gesture 1 stands for "hoof", or maybe it stands for
"paper"; the meaning is not clear to him. Given the gestures made by both cows
over all \(N\) games, please help Farmer John determine the maximum possible
number of games the first cow could have possibly won, given an appropriate
mapping between numbers and their respective gestures.
Problem credits: Brian Dean
Problem credits: Brian Dean
The first line of the input file contains \(N\).
Each of the remaining \(N\) lines contain two integers (each 1, 2, or 3),
describing a game from Farmer John's perspective.
Print the maximum number of games the first of the two cows could possibly have
won.
hps.inhps.out5
1 2
2 2
1 3
1 1
3 22One solution (of several) for this sample case is to have 1 represent
"scissors", 2 represent "hoof", and 3 represent "paper". This assignment gives
2 victories to the first cow ("1 3" and "3 2"). No other assignment leads to
more victories.
riseoj 작성
출처 올림피아드 > USACO > 2016-2017 > January > Bronze
평가 및 의견
Hoof, Paper, Scissors
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Hoof, Paper, Scissors