|
|||
IntransitivePeter has some unconventional dice. A number can appear multiple times on their faces, and the numbers are not necessarily between 1 and 6. For example, he has three dice (), with the following numbers on their faces: A: 2, 2, 4, 4, 9, 9 B: 1, 1, 6, 6, 8, 8 C: 3, 3, 5, 5, 7, 7If Panna uses die and Peter uses die in a game where the winner is the one who rolls a higher number (neither wins in the case of a tie), then Panna has an advantage. This can be shown by considering the 36 possible roll pairs and counting how many times the number rolled on is greater than the number rolled on . In our case: (2,1),(2,1) (2,1),(2,1) (4,1),(4,1) (4,1),(4,1) (9,1),(9,1),(9,6),(9,6),(9,8),(9,8) (9,1),(9,1),(9,6),(9,6),(9,8),(9,8) Here, we went through the numbers on die one by one and paired them with numbers from die that they are greater than. We see that in 20 out of 36 cases, die rolls higher numbers than die , meaning Panna wins in more than half the cases. Similarly, the same is true for versus : wins in more than half the cases. And most surprisingly, the same holds for versus . In everyday terms, is stronger than , is stronger than , and is stronger than ! Peter calls such a set of three dice with this property interesting, and now he wants to know how many interesting triples of dice exist in a set of unconventional dice.Input specificationThe first line contains the number of dice, . Then lines follow each of with 6 numbers: . The dice are pairwise different. Output specificationA line with the number of interesting dice triplets. Constraints
Sample input 1
Sample output 1
Sample input 2
Sample output 2
Sample input 3
Sample output 3
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |