{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv style\u003d\"width:40.00%\" class\u003d\"illustration\"\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/974ccde7b0f3ee31ae3014f14a995664?v\u003d1715595679\" alt\u003d\"/problems/zipline/file/statement/en/img-0001.jpg\" class\u003d\"illustration\"\u003e\n \n \u003c/div\u003e\n \u003cp\u003eA zipline is a very fun and fast method of travel. It uses a\n very strong steel cable, connected to two poles. A rider (which\n could be a person or some cargo) attaches to a pulley which\n travels on the cable. Starting from a high point on the cable,\n gravity pulls the rider along the cable.\u003c/p\u003e\n \u003cp\u003eYour friend has started a company which designs and installs\n ziplines, both for fun and for utility. However, there’s one\n key problem: determining how long the cable should be between\n the two connection points. The cable must be long enough to\n reach between the two poles, but short enough that the rider is\n guaranteed to stay a safe distance above the ground. Help your\n friend determine these bounds on the length.\u003c/p\u003e\n \u003cp\u003eThe cable connects to two vertical poles that are\n \u003cspan class\u003d\"tex2jax_process\"\u003e$w$\u003c/span\u003e meters apart, at\n heights \u003cspan class\u003d\"tex2jax_process\"\u003e$g$\u003c/span\u003e and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$h$\u003c/span\u003e meters, respectively.\n You may assume that the cable is inelastic and has negligible\n weight compared to the rider, so that there is no sag or slack\n in the cable. That is, at all times the cable forms two\n straight line segments connecting the rider to the two poles,\n with the sum of the segments lengths equal to the total length\n of the cable. The lowest part of the rider hangs \u003cspan class\u003d\"tex2jax_process\"\u003e$r$\u003c/span\u003e meters below the cable; therefore\n the cable must stay at least \u003cspan class\u003d\"tex2jax_process\"\u003e$r$\u003c/span\u003e meters above the ground at all\n times during the ride. The ground is flat between the two\n poles. Please refer to the diagram in Figure\u0026nbsp;1 for more\n information.\u003c/p\u003e\n \u003cdiv id\u003d\"fig:zipline_diagram\" class\u003d\"figure\"\u003e\n \u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/6d75d5bb21b7de550ff60cfea5bc337c?v\u003d1715595679\" alt\u003d\"\\includegraphics[width\u003d0.7\\textwidth ]{zipline.png}\" style\u003d\"width:70.00%\"\u003e\n \u003cdiv class\u003d\"caption\"\u003e\n \u003cb\u003eFigure 1\u003c/b\u003e: A zipline, annotated with the four\n variables used to describe it.\n \u003c/div\u003e\n \u003c/center\u003e\n \u003c/div\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe input starts with a line containing an integer\n \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e, where \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le n \\le 1\\, 000$\u003c/span\u003e. The next\n \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e lines each describe a\n zipline configuration with four integers: \u003cspan class\u003d\"tex2jax_process\"\u003e$w$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$g$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$h$\u003c/span\u003e, and \u003cspan class\u003d\"tex2jax_process\"\u003e$r$\u003c/span\u003e. These correspond to the variables\n described above. The limits on their values are: \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le w, g, h \\le 1\\, 000\\, 000$\u003c/span\u003e, and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le r \\le \\min (g,\n h)$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eFor each zipline, print a line of output with two lengths\n (in meters): the minimum and maximum length the cable can be\n while obeying the above constraints. Both lengths should have\n an absolute error of at most \u003cspan class\u003d\"tex2jax_process\"\u003e$10^{-6}$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1000 100 100 20\n100 20 30 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1000.00000000 1012.71911209\n100.49875621 110.07270325\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}