Input
The input is divided into 3 parts as follows:
The first line of the input data contains a number N with the total number of players (N > 0).
The following lines represent the main game phase where the features are being completed during the players’ turns. These lines are composed by the player number that got the feature, the feature type, and only in case the feature is city or road, the number of tiles to calculate the proper points. In this phase we will apply the main scoring rules.
At the end of players’ turns, when there are no tiles remaining, all the incomplete features are scored. This final phase is indicated with a colon “:” symbol in a new line.
The following lines represent the final game phase. Now we the non-completed features and also the fields gained by players can be scored. These lines contain, as those above, a similar structure, but in this case the cloisters have a third parameter that indicates the surrounding tiles and the third parameter of the fields indicates the amount of bordering cities. Now the final scoring rules applies instead.
And finally the “.” symbol indicates the end of input data lines.
Output
About statements
The official statement of a problem is always the one
in the PDF document. The HTML version of the statement
is also given to help you, but may contain some content
that is not well displayed. In case of doubt, always use the PDF.
Public test cases
Input
4
1 city 4
2 cloister
3 road 3
:
1 field 2
3 road 6
4 cloister 1
.