{"problem":{"name":"G. Ali and the Breakfast","description":{"content":"Ali Mansour was having a breakfast with his friends at the dorm. He will pour tea in their cups. He wanted to make the breakfast more exciting, so he decided to throw a drop of tea at their cups. Ali","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10216G"},"statements":[{"statement_type":"Markdown","content":"Ali Mansour was having a breakfast with his friends at the dorm. He will pour tea in their cups. He wanted to make the breakfast more exciting, so he decided to throw a drop of tea at their cups.\n\nAli will throw the drop randomly from point $(0, 0)$ at a random (formally random) angle between $L$ and $R$ with initial speed $V$. \n\nHe has $N$ friends, and each has a cup of different width. Let's assume that each cup has a $0$ height and is placed on the ground (The $X$ Axis). Given each cup's position, for each cup calculate the probability that the drop will fall in this cup. Note: it's possible for two cups to overlap or intersect.\n\nFirst line of input will be $T$ the number of test cases.\n\nEach test case is described by $4$ space separated integers, $N, V, L, R$ ($1 <= N <= 1000$), ($1 <= V <= 10^9$), ($0 <= L <= R <= 90$).\n\nThen $N$ lines, the positions of the cups ($X 1_i$, $X 2_i$), ($0 <= X 1_i < X 2_i <= 10^9$)\n\nFor each test case print $N$ lines. in the $I_{t h}$ line print the probability that the drop will fall in the $I_{t h}$ cup.\n\nPrint the probability rounded to exactly $4$ digits\n\nConsider $g$ = $10$ $m$.$s^(-2)$\n\n## Input\n\nFirst line of input will be $T$ the number of test cases.Each test case is described by $4$ space separated integers, $N, V, L, R$ ($1 <= N <= 1000$), ($1 <= V <= 10^9$), ($0 <= L <= R <= 90$).Then $N$ lines, the positions of the cups ($X 1_i$, $X 2_i$), ($0 <= X 1_i < X 2_i <= 10^9$)\n\n## Output\n\nFor each test case print $N$ lines. in the $I_(t h)$ line print the probability that the drop will fall in the $I_(t h)$ cup.Print the probability rounded to exactly $4$ digits\n\n[samples]\n\n## Note\n\nConsider $g$ = $10$ $m$.$s^(-2)$","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ N \\in \\mathbb{Z} $ be the number of cups.  \n- Let $ V > 0 $ be the initial speed (m/s).  \n- Let $ L, R \\in \\mathbb{R} $ be the lower and upper bounds of the launch angle (degrees), with $ 0 \\le L < R \\le 90 $.  \n- For $ i \\in \\{1, \\dots, N\\} $, let $ [x_{1,i}, x_{2,i}] \\subset \\mathbb{R}_{\\ge 0} $ be the interval on the x-axis representing the $ i $-th cup’s width, with $ 0 \\le x_{1,i} < x_{2,i} \\le 10^9 $.  \n- Let $ g = 10 \\, \\text{m/s}^2 $ be the gravitational acceleration.  \n\n**Constraints**  \n1. $ 1 \\le T \\le \\text{unknown} $ (implied by input format)  \n2. $ 1 \\le N \\le 1000 $  \n3. $ 1 \\le V \\le 10^9 $  \n4. $ 0 \\le L < R \\le 90 $  \n5. $ 0 \\le x_{1,i} < x_{2,i} \\le 10^9 $ for all $ i \\in \\{1, \\dots, N\\} $  \n\n**Objective**  \nFor each cup $ i $, compute the probability $ P_i $ that a projectile launched from $ (0,0) $ with speed $ V $ and angle $ \\theta \\sim \\text{Uniform}(L^\\circ, R^\\circ) $ lands within $ [x_{1,i}, x_{2,i}] $.  \n\nThe horizontal range of a projectile is:  \n$$\nx(\\theta) = \\frac{V^2 \\sin(2\\theta)}{g}, \\quad \\theta \\in [L^\\circ, R^\\circ]\n$$  \nConvert angles to radians: $ \\theta_{\\text{rad}} = \\theta \\cdot \\frac{\\pi}{180} $.  \n\nLet $ \\Theta \\sim \\text{Uniform}(L, R) $ in degrees. Define the range function:  \n$$\nf(\\theta) = \\frac{V^2}{g} \\sin\\left(2 \\cdot \\theta \\cdot \\frac{\\pi}{180}\\right)\n$$  \n\nThen:  \n$$\nP_i = \\mathbb{P}\\left( x_{1,i} \\le f(\\Theta) \\le x_{2,i} \\right) = \\frac{1}{R - L} \\cdot \\mu\\left( \\left\\{ \\theta \\in [L, R] : f(\\theta) \\in [x_{1,i}, x_{2,i}] \\right\\} \\right)\n$$  \nwhere $ \\mu $ denotes Lebesgue measure (length) of the set of angles satisfying the condition.  \n\n**Output**  \nFor each test case, output $ N $ lines, each containing $ P_i $ rounded to exactly 4 decimal places.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10216G","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}