You are given the daily values V_1 ... V_n of a portfolio. Let the running peak be P_t = max(V_1, ..., V_t).
The drawdown on day t is (P_t - V_t) / P_t. The maximum drawdown is the largest drawdown over all days.
A day t is underwater if V_t < P_t. The maximum drawdown duration is the length of the longest run of consecutive underwater days; a run that is still open on the last day counts. If no day is underwater, both answers are 0.
The first line contains the integer n. Each of the next n lines contains one value V_t with at most 2 digits after the decimal point.
Two numbers: the maximum drawdown (with relative error at most 1e-9) and the maximum drawdown duration in days (an integer).
1 <= n <= 10000
0.01 <= V_t <= 10^6
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
Numeric answers are accepted if they are within a relative tolerance of 1e-09 of the expected value.
6 100.00 90.00 95.00 105.00 80.00 100.00
0.23809523809523808 2
3 50.00 60.00 70.00
0.0 0