{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eThe Power Cube is used as a stash of Exotic Power. There are $n$ cities numbered $1, 2, \\dots, n$ where allowed to trade it. The trading price of the Power Cube in the $i$-th city is $a_i$ dollars per cube. Noswal is a foxy businessman and wants to quietly make a fortune by buying and reselling Power Cubes. To avoid being discovered by the police, Noswal will go to the $i$-th city and choose exactly one of the following three options on the $i$-th day:\u003cbr\u003e\u003cbr\u003e1. spend $a_i$ dollars to buy a Power Cube\u003cbr\u003e2. resell a Power Cube and get $a_i$ dollars if he has at least one Power Cube\u003cbr\u003e3. do nothing\u003cbr\u003e\u003cbr\u003eObviously, Noswal can own more than one Power Cubes at the same time. After going to the $n$ cities, he will go back home and stay away from the cops. He wants to know the maximum profit he can earn. In the meanwhile, to lower the risks, he wants to minimize the times of trading (include buy and sell) to get the maximum profit. Noswal is a foxy and successful businessman so you can assume that he has infinity money at the beginning.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases. The first line of input contains a positive integer $T$ ($T\\leq 250$), indicating the number of test cases. For each test case:\u003cbr\u003eThe first line has an integer $n$. ($1\\leq n \\leq 10^5$)\u003cbr\u003eThe second line has $n$ integers $a_1, a_2, \\dots, a_n$ where $a_i$ means the trading price (buy or sell) of the Power Cube in the $i$-th city. ($1 \\leq a_i \\leq 10^9$)\u003cbr\u003eIt is guaranteed that the sum of all $n$ is no more than $5\\times 10^5$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each case, print one line with two integers —— the maximum profit and the minimum times of trading to get the maximum profit."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e3\r\n4\r\n1 2 10 9\r\n5\r\n9 5 9 10 5\r\n2\r\n2 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e16 4\r\n5 2\r\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003eIn the first case, he will buy in 1, 2 and resell in 3, 4. \u003ci\u003eprofit \u003d - 1 - 2 + 10 + 9 \u003d 16\u003c/i\u003e\u003cbr\u003eIn the second case, he will buy in 2 and resell in 4. \u003ci\u003eprofit \u003d - 5 + 10 \u003d 5\u003c/i\u003e\u003cbr\u003eIn the third case, he will do nothing and earn nothing. \u003ci\u003eprofit \u003d 0\u003c/i\u003e\u003cbr\u003e"}}]}