| UNICAMP Selection Contest 2025 |
|---|
| Закончено |
During the programming marathon in Campo Grande in 2022, Jake Peralta and his friend Charles Boyle took the opportunity to visit the Bioparque Pantanal, one of the largest freshwater aquariums in the world. There, they were enchanted by the variety of fish of various species.
While observing the tanks, Jake had an idea for a game: Boyle would randomly choose a fish (with equal probability among all), and Jake would have to guess which one it was by asking only yes-or-no questions.
Jake could ask anything he wanted: "Does the name of the fish have an even number of letters?", "Does the fish have blue scales?", "Is the fish native to Brazil?", and so on...
Being extremely strategic, Jake decided to follow an optimal plan, minimizing the expected number of questions needed to discover the chosen fish. However, since he is not that good with calculations, he asked for your help. Your task is: given the list of names of the fish in the aquarium, all with distinct names, calculate the expected number of questions that Jake will need to ask if he uses the optimal strategy.
The first line contains an integer $$$N$$$ ($$$1 \leq N \leq 10^5$$$), the number of fish.
The next $$$N$$$ lines contain the distinct names of the fish. Each name consists only of letters from the Latin alphabet (uppercase and/or lowercase). The total sum of the lengths of the names does not exceed $$$10^6$$$.
Print the expected number of questions needed. The allowed absolute or relative error is at most $$$10^{-4}$$$.
10salmaoatumsardinhatilapiabacalhaupangamerluzadouradodorinemo
4.4000000000
1peixe
1.0000000000
2atumtilapia
2.0000000000
After narrowing down the options to just one fish, Jake still needs one turn to confirm his answer. For example, even when $$$N=1$$$, he must ask a question. See the examples for more details.
| Название |
|---|


