405377: GYM101917 J Luca and Stock
Description
Luca wants to buy stock and invest it, for simplification let's say that he can only buy at the beginning of the day and sell at the end of a day. Each day has a value p associated with it, it's the relative change of the stock value during the day as a percent. Given a list of N days Luca can do 1 of 2 things, get the expected percent of change in stock price for a range of consecutive days, or modify the value p of a single day to an arbitrary value.
InputAn integer N ($$$1<=N<=10^{5}$$$) the amount of days, followed by a single line with N floating point numbers with at most 3 decimals the value pi ($$$0<=p<=10$$$) for each day. Where of course 0 means it loses all of its value and 10 means it becomes 10 times as expensive.
An integer Q ($$$1<=Q<=10^{5}$$$), the amount of queries Luca will do.
Q lines, each with 3 numbers, the first of which represents the operation Luca will do.
If they come with the format 1 x p it means its a change query, so Luca will change the value of the xth position from its previous value to p. ($$$1<=x<=N, 0<=p<=10$$$)
If they come with the format 2 l r it means a price range query, which implies Luca will buy stock at the beginning of day l and sell it at the end of day r. ($$$1<=l<=r<=N$$$)
OutputFor queries of type 2 output a single integer, the final relative value of the stock. Your answer will be considered correct if the relative or absolute error is less than $$$10e^{-6}$$$. If the answer is way too big (bigger or equal to $$$2^{100}$$$) print "INFINITE!" instead.
ExampleInput5Output
1 1.5 0.66 2.0 0.1
5
2 1 3
1 1 2
2 1 3
2 1 5
2 4 5
0.990000000
1.980000000
0.396000000
0.200000000