{"problem":{"name":"I. Polycarp and Heat Exchangers","description":{"content":"Polycarp does experiments again. He has N triangle heat exchangers on the field. Each i-th heat exchanger has input and output and their coefficients kini and kouti respectively. If two heat exchanger","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":524288},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10083I"},"statements":[{"statement_type":"Markdown","content":"Polycarp does experiments again. He has N triangle heat exchangers on the field. Each i-th heat exchanger has input and output and their coefficients kini and kouti respectively. If two heat exchangers intersect (or first one touches second one), then thir inputs becamee molten together and their input coefficient became k, where , k1 and k2 are input coefficients of heat exchangers. Each point of field emits heat, heat comes out with specific speed. If this point is beneath some heat exchangers, it's value is multiplied by final value of their input coefficient and then it's multiplied by their output coefficients. Square of field with sides's length 1 emits 1 unit of heat. Polycarp wants to know value of heat per second, which emits all heat exchangers.\n\nThe first line contains N, 1 ≤ N ≤ 10. N lines follow, each containing x1i, y1i, x2i, y2i, x3i, y3i, kini, kouti — coordinates of vertexes i-th heat exchanger, input and output coefficients. All numbers are separated by space, coordinates are integers, which are lesser than 101 and greater than  - 101, 0.1 ≤ kini, kouti ≤ 2.0. Triangles are not degenerate.\n\nOutput summary value of heat per second, which emits all heat exchangers. You may assume that answers is coparated with the precision of 10 - 4. \n\n## Input\n\nThe first line contains N, 1 ≤ N ≤ 10. N lines follow, each containing x1i, y1i, x2i, y2i, x3i, y3i, kini, kouti — coordinates of vertexes i-th heat exchanger, input and output coefficients. All numbers are separated by space, coordinates are integers, which are lesser than 101 and greater than  - 101, 0.1 ≤ kini, kouti ≤ 2.0. Triangles are not degenerate.\n\n## Output\n\nOutput summary value of heat per second, which emits all heat exchangers. You may assume that answers is coparated with the precision of 10 - 4. \n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $, $ 1 \\leq N \\leq 10 $, be the number of triangular heat exchangers.  \nFor each $ i \\in \\{1, \\dots, N\\} $:  \n- Let $ T_i \\subset \\mathbb{R}^2 $ be a non-degenerate triangle with vertices $ (x_{i1}, y_{i1}), (x_{i2}, y_{i2}), (x_{i3}, y_{i3}) $.  \n- Let $ k_{\\text{in},i} \\in \\mathbb{R} $, $ 0.1 \\leq k_{\\text{in},i} \\leq 2.0 $, be the input coefficient.  \n- Let $ k_{\\text{out},i} \\in \\mathbb{R} $, $ 0.1 \\leq k_{\\text{out},i} \\leq 2.0 $, be the output coefficient.  \n\nLet $ \\mathcal{I} \\subseteq \\{1, \\dots, N\\} $ be a maximal set of mutually intersecting (including touching) triangles.  \nFor each such $ \\mathcal{I} $, define the merged input coefficient:  \n$$\nk_{\\text{in}}^{\\mathcal{I}} = \\prod_{i \\in \\mathcal{I}} k_{\\text{in},i}\n$$  \nEach triangle $ i \\in \\mathcal{I} $ contributes output coefficient $ k_{\\text{out},i} $ independently.  \n\nLet $ A_i = \\text{Area}(T_i) $ be the area of triangle $ T_i $.  \nLet $ \\mathcal{P} \\subset \\mathbb{R}^2 $ be the union of all triangles $ T_i $, $ i = 1, \\dots, N $.  \n\n**Constraints**  \n1. Coordinates are integers: $ -100 < x_{ij}, y_{ij} < 100 $.  \n2. Triangles are non-degenerate.  \n3. Heat emission rate per unit area is 1 unit per second on the base field.  \n\n**Objective**  \nCompute the total heat emission per second:  \n$$\nH = \\sum_{\\mathcal{I} \\in \\mathcal{C}} \\left( k_{\\text{in}}^{\\mathcal{I}} \\cdot \\sum_{i \\in \\mathcal{I}} k_{\\text{out},i} \\cdot A_i \\right)\n$$  \nwhere $ \\mathcal{C} $ is the set of all connected components (maximal intersecting groups) of triangles.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10083I","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}