{"raw_statement":[{"iden":"statement","content":"You decided to stay an extra day in Paris visiting favorite places of Parisians around T'el'ecom ParisTech. You want to collect information about these favorite places, but asking people to fill in surveys is less fun than coding. For this reason, you asked the Parisian Agency for Really Imprecise Surveys to do it for you. You sent them a list of the P places you were interested in.\n\nAfter surveying exactly 10 000 persons and asking them their favorite place (among these P places), the agency has just sent you the results. All persons surveyed answered the question. Unfortunately, the agency rounded the percentage results to the nearest integer, using the following formula: $r e s u l t = floor.l o r i g i n a l_v a l u e + frac(1, 2) floor.r$. In particular, decimal values of $. 50$ are rounded up.\n\nBut since $10000$ persons were surveyed, you should have been able to get percentage values precise to the second decimal. What a loss of precision! You want to know the range in which each original result could be.\n\nThe input comprises several lines: \n\n*Limits* \n\nIf the results given by the agency are not consistent, print a single line with the word IMPOSSIBLE. Otherwise the output should consist of P lines, each of them should consist of the name of a place followed by a single space and two numbers, the smallest and the largest percentage values that place could have had in the original results, as floating-point numbers with two decimals separated with a single space (each number must have at least one digit before the decimal point, even if it is 0, and exactly 2 decimals, even if the trailing ones are 0). The places must be in the same order as in the input.\n\n"},{"iden":"input","content":"The input comprises several lines:   The first line consists of an integer $P$.  Each of the following $P$ lines consists of the name of a place followed by an integer $i$, separated with a single space. *Limits*   $1 <= P <= 10000$;  the name of a place is a string of between 1 and 20 characters among Latin alphabet letters ('A' to 'Z' and 'a' to 'z') and the underscore character ('_');  no two names are the same;  $0 <= i <= 100$. "},{"iden":"output","content":"If the results given by the agency are not consistent, print a single line with the word IMPOSSIBLE. Otherwise the output should consist of P lines, each of them should consist of the name of a place followed by a single space and two numbers, the smallest and the largest percentage values that place could have had in the original results, as floating-point numbers with two decimals separated with a single space (each number must have at least one digit before the decimal point, even if it is 0, and exactly 2 decimals, even if the trailing ones are 0). The places must be in the same order as in the input."},{"iden":"examples","content":"Input4\nCatacombes 32\nCite_Universitaire 22\nArenes_de_Lutece 26\nObservatoire 19\nOutputCatacombes 31.53 32.49\nCite_Universitaire 21.53 22.49\nArenes_de_Lutece 25.53 26.49\nObservatoire 18.53 19.49\nInput7\nAqueduc_Medicis 11\nParc_Montsouris 40\nPlace_Denfert 10\nHopital_Sainte_Anne 4\nButte_aux_cailles 20\nCite_florale 12\nPrison_de_la_Sante 0\nOutputAqueduc_Medicis 11.06 11.49\nParc_Montsouris 40.06 40.49\nPlace_Denfert 10.06 10.49\nHopital_Sainte_Anne 4.06 4.49\nButte_aux_cailles 20.06 20.49\nCite_florale 12.06 12.49\nPrison_de_la_Sante 0.06 0.49\nInput2\nCatacombes 50\nArenes_de_Lutece 49\nOutputIMPOSSIBLE\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ P \\in \\mathbb{Z}^+ $ be the number of places.  \nLet $ R = (r_1, r_2, \\dots, r_P) $ be the rounded percentages (integers) reported by the agency, where $ r_i \\in \\{0, 1, \\dots, 100\\} $.  \nLet $ x_i \\in \\mathbb{R} $ be the true percentage for place $ i $, such that $ x_i \\in [0, 100] $ and $ \\sum_{i=1}^P x_i = 100 $.  \nLet $ n = 10000 $ be the number of respondents. The true count for place $ i $ is $ c_i = \\frac{x_i}{100} \\cdot n $, so $ c_i \\in [0, 10000] $ and $ \\sum_{i=1}^P c_i = 10000 $.  \nRounding rule: $ r_i = \\left\\lfloor x_i + \\frac{1}{2} \\right\\rfloor $, i.e., $ r_i - 0.5 \\leq x_i < r_i + 0.5 $.\n\n**Constraints**  \n1. $ \\sum_{i=1}^P r_i \\in \\{99, 100, 101\\} $ (necessary for consistency, since rounding may shift total by at most $ P \\cdot 0.5 $, but total must be 100).  \n2. For each $ i \\in \\{1, \\dots, P\\} $:  \n   $$\n   r_i - 0.5 \\leq x_i < r_i + 0.5\n   $$  \n3. $ \\sum_{i=1}^P x_i = 100 $  \n4. $ x_i \\geq 0 $ for all $ i $, and $ x_i \\leq 100 $ for all $ i $\n\n**Objective**  \nIf no $ (x_1, \\dots, x_P) $ satisfies constraints, output \"IMPOSSIBLE\".  \nOtherwise, for each place $ i $, compute:  \n- Minimum possible $ x_i $: $ \\max\\left(r_i - 0.5, \\; 100 - \\sum_{j \\ne i} (r_j + 0.5 - \\epsilon)\\right) $  \n- Maximum possible $ x_i $: $ \\min\\left(r_i + 0.5 - \\epsilon, \\; 100 - \\sum_{j \\ne i} (r_j - 0.5)\\right) $  \n\nFormally, for each $ i $:  \n$$\n\\text{min}_i = \\max\\left( r_i - 0.5, \\; 100 - \\sum_{j \\ne i} (r_j + 0.5) \\right)\n$$  \n$$\n\\text{max}_i = \\min\\left( r_i + 0.5, \\; 100 - \\sum_{j \\ne i} (r_j - 0.5) \\right)\n$$  \nwith the understanding that $ \\text{min}_i \\leq \\text{max}_i $ must hold for feasibility.  \nOutput $ \\text{min}_i $ and $ \\text{max}_i $ as floating-point numbers with exactly two decimal digits.","simple_statement":"Given P places and survey results rounded to nearest integers (from 10,000 respondents), find for each place the minimum and maximum possible original percentage (to 2 decimals) that could have been rounded to the given integer. If no valid distribution exists, print \"IMPOSSIBLE\".","has_page_source":false}