{"trustable":true,"prependHtml":"\u003cstyle\u003e.table {width: 100%;} .table-bordered {border: 1px solid #222; border-collapse: collapse; border-spacing: 0;} .table-bordered th { border: 1px solid #222; }.table-bordered td { border: 1px solid #222; padding: 0 5px; }\u003c/style\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eDr. Picks designed a complex resistor after observing the transit of Venus. To simplify the problem, the constants in the question differ from the real world.\u003c/p\u003e\n\u003cp\u003eInside this resistor, there are $ n $ independent tanks numbered $ 1 \\sim n $. The tanks are cylindrical, with a base area of $ 1 ~ m^2 $. Each tank has a valve at the top and bottom, allowing water to flow through at a rate of $ 1 ~ m^3/s $. The upper valve of each tank is connected to a faucet that can supply water indefinitely, while the lower valve is open to let water flow out. Both the top and bottom of the tank have an interface, and the resistivity of water is $ 1 ~ \\Omega \\cdot m $.\u003c/p\u003e\n\u003cp\u003eThe height of the tank is sufficiently high, and there is a conductive float floating on the water surface, connected to the interface at the top of the tank by a wire. Initially, the $ i $-th tank contains $ a_i ~ m^3 $ of water.\u003c/p\u003e\n\u003cp\u003eDr. Picks will then need to debug this complex resistor. He will perform the following five operations.\u003c/p\u003e\n\u003cp\u003e1. Open the upper valves of all tanks numbered in $ [l,r] $ for $ x $ seconds, then close their upper valves.\u003c/p\u003e\n\u003cp\u003e2. Open the lower valves of all tanks numbered in $ [l,r] $ for $ x $ seconds, then close their lower valves.\u003c/p\u003e\n\u003cp\u003e3. Connect the lower valves of all tanks numbered in $ [l,r] $ to the sea via a siphon in such a way that these tanks contain exactly $ x ~ m^3 $ of water, then close their lower valves and remove the siphon.\u003c/p\u003e\n\u003cp\u003e4. Connect a power source with an electromotive force of $ 1 ~ V $ to the upper and lower interfaces of the $ y $-th tank. The power source has no internal resistance, and Dr. Picks will measure the current passing through the power source, then remove the power source.\u003c/p\u003e\n\u003cp\u003e5. Since places soaked with water will leave obvious water stains while places that have not been soaked will not, Dr. Picks can measure the height of the water stain in the $ y $-th tank at this time to infer the maximum amount of water that was present, saving his construction costs.\u003c/p\u003e\n\u003cp\u003eNow, he asks you to help him conduct a preliminary experiment. Can you tell him the current measured each time and what the maximum amount of water measured is?\u003c/p\u003e\n\u003ch3\u003eInput Format\u003c/h3\u003e\n\u003cp\u003eThe first line contains two numbers: $ n, m $.\u003c/p\u003e\n\u003cp\u003eThe next line contains $ n $ numbers, where the $ i $-th number indicates that initially the $ i $-th tank contains $ a_i ~ m^3 $ of water.\u003c/p\u003e\n\u003cp\u003eIn the next $ m $ lines, the first number in the $ i $-th line $ t_i $ indicates the type of operation:\u003c/p\u003e\n\u003cp\u003eIf $ t_i \u003d 1 $, then the next three integers $ l_i, r_i, x_i $ indicate to open the upper interface of all tanks numbered in $ [l_i,r_i] $ for $ x_i $ seconds.\u003c/p\u003e\n\u003cp\u003eIf $ t_i \u003d 2 $, then the next three integers $ l_i, r_i, x_i $ indicate to open the lower interface of all tanks numbered in $ [l_i,r_i] $ for $ x_i $ seconds.\u003c/p\u003e\n\u003cp\u003eIf $ t_i \u003d 3 $, then the next three integers $ l_i, r_i, x_i $ indicate to connect all tanks numbered in $ [l_i,r_i] $ to the sea, so that these tanks contain exactly $ x_i ~ m^3 $ of water.\u003c/p\u003e\n\u003cp\u003eIf $ t_i \u003d 4 $, then the next integer $ y_i $ indicates to measure the current when connecting a power source with an electromotive force of $ 1 ~ V $ to the upper and lower interfaces of the $ y_i $-th tank.\u003c/p\u003e\n\u003cp\u003eIf $ t_i \u003d 5 $, then the next integer $ y_i $ indicates to measure the height of the water stain in the $ y_i $-th tank at this time.\u003c/p\u003e\n\u003ch3\u003eOutput Format\u003c/h3\u003e\n\u003cp\u003eFor each $ t_i \u003d 4 $, output an integer representing the reciprocal of the current passing through the power source (in units of $ A^{-1} $), if the current is infinite, output 0.\u003c/p\u003e\n\u003cp\u003eFor each $ t_i \u003d 5 $, output an integer representing the height of the water stain in the $ y_i $-th tank (in units of $ m $).\u003c/p\u003e\n\u003ch3\u003eSample Input 1\u003c/h3\u003e\n\u003cpre\u003e5 6\n1 2 3 4 5\n2 1 3 2\n4 1\n1 1 4 1\n5 3\n3 1 5 4\n4 2\n\n\u003c/pre\u003e\n\n\n\u003ch3\u003eSample Output 1\u003c/h3\u003e\n\u003cpre\u003e0\n3\n4\n\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Input 2\u003c/h3\u003e\n\u003cp\u003eSee related file download\u003c/p\u003e\n\u003ch3\u003eSample Output 2\u003c/h3\u003e\n\u003cp\u003eSee related file download\u003c/p\u003e\n\u003ch3\u003eSample Input 3\u003c/h3\u003e\n\u003cp\u003eSee related file download\u003c/p\u003e\n\u003ch3\u003eSample Output 3\u003c/h3\u003e\n\u003cp\u003eSee related file download\u003c/p\u003e\n\u003ch3\u003eConstraints and Agreements\u003c/h3\u003e\n\u003cp\u003e\u003cstrong\u003eTime Limit:\u003c/strong\u003e $2\\texttt{s}$\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eSpace Limit:\u003c/strong\u003e $128\\texttt{MB}$\u003c/p\u003e\n\u003cdiv class\u003d\"table-responsive\"\u003e\n\u003ctable class\u003d\"table table-bordered\"\u003e\u003cthead\u003e\u003ctr\u003e\u003cth\u003eTest Point Number\u003c/th\u003e\u003cth\u003e$n\u003d$\u003c/th\u003e\u003cth\u003e$m\u003d$\u003c/th\u003e\u003cth\u003eAgreement\u003c/th\u003e\u003c/tr\u003e\u003c/thead\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e$1000$\u003c/td\u003e\u003ctd\u003e$1000$\u003c/td\u003e\u003cth\u003e\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e2\u003c/td\u003e\u003ctd\u003e$1000$\u003c/td\u003e\u003ctd\u003e$1000$\u003c/td\u003e\u003cth\u003e\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e3\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003cth\u003eNo operation 2\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e4\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003cth\u003eNo operation 2\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e5\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003cth\u003eNo operation 1 and operation 5\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e6\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003cth\u003eNo operation 1\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e7\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003cth\u003eNo operation 1\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e8\u003c/td\u003e\u003ctd\u003e$5 \\times10^5$\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003cth\u003eNo operation 5\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e9\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003ctd\u003e$10^5$\u003c/td\u003e\u003cth\u003e\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003ctd\u003e$5 \\times 10^5$\u003c/td\u003e\u003cth\u003e\u003c/th\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\n\n\u003cp\u003eFor all data: $ 1 \\leq n, m \\leq 5 \\times 10^5, ~ 0 \\leq a_i, x_i \\leq 10^9, 1 \\leq l_i \\leq r_i \\leq n, ~ 1 \\leq y_i \\leq n $.\u003c/p\u003e\n\u003ch3\u003eTips\u003c/h3\u003e\n\u003cp\u003ePossible physical formulas:\u003c/p\u003e\n\u003cp\u003e1. Ohm\u0027s Law: $ I \u003d \\frac{U}{R} $, where $ I, U, R $ represents current, voltage, and resistance respectively.\u003c/p\u003e\n\u003cp\u003e2. Resistance formula: $ R \u003d \\rho \\frac{L}{S} $, where $ R, \\rho, L, S $ represents resistance, resistivity, length of resistance, and cross-sectional area.\u003c/p\u003e\n\u003ch3\u003eDownload\u003c/h3\u003e\n\u003cp\u003e\u003ca href\u003d\"https://uoj.ac/download.php?type\u003dproblem\u0026amp;id\u003d164\"\u003eRelated file download\u003c/a\u003e\u003c/p\u003e"}}]}