ZOJ Problem Set - 2854
Once upon a time, there was a beautiful princess named Illyria. She led a happy life in her palace. One day driven by her curiosity, she went out and met a witch. The evil witch envied the pretty girl so she cursed her. The poor Illyria became a fish, however, she was even more beautiful. Her scales were shining, reflecting amazing colors of light, which made the witch much angrier. The witch decided to trap her in a magic fish bowl and left it in a deep forest. The fish bowl was a closed polyhedron made of opaque material. It was rather dark and cold inside the fish bowl and the only thing coming along with her was some small floating grass. She felt so lonely and began to sing in sorrow every day.
Many days later, a prince from another country went hunting in that forest. He was deeply attracted by the graceful singing. He found a strange box in the forest, surrounded by animals who are listening to the songs. In order to know the box, he came to a sophist in his country. The sophist told him the story about Illyria, as well as the fact that if the fish bowl was full of light inside, the curse would vanish. The prince had learnt from a virtuous wizard the magic that makes fire in water and he decided to save the princess from cold and darkness. However, he didn't master the magic very well. The fire could appear in random places in the fish bowl. Could the prince save Illyria and lived a happy life with her?
Given the description of the fish bowl, your task is to calculate the probability that the prince can save the princess.
The input contains multiple test cases!
The first line of each test case is an integer N (4 <= N <= 20) indicating the number of faces of the fish bowl. The following N lines describe the faces, with each face in each line. Each line will be in the form of
Mi xi1 yi1 zi1 ... xiMi yiMi ziMi
, where Mi (1 <= i <= N, 3 <= Mi <= 20) indicates the number of points of the i-th face of the bowl and (xij, yij, zij) (1 <= j <= Mi) is the coordinate of j-th point of the i-th face.
It's guaranteed that:
Output the percentage that the boy would be happy to the nearest 0.01% in one line. Specially, if there is no such position, output "Poor boy" instead. You can assume there is no such position iff the volume of the area that meets the requirement is less than 10-9.
The figures of the two samples are shown below:
Author: GUAN, Yao
Source: Zhejiang Provincial Programming Contest 2007