아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Independent Events

시간 제한2초메모리 제한512 MB

요약
확률 배열에서 구간 곱셈 갱신을 처리하며, 구간 질의마다 log(1 - p_i)의 합을 구해 출력한다.
난이도

보통10점 중 7점

유형
세그먼트 트리, 수학, 누적 합
정답자
아직 제출이 없습니다

문제

Yuuka is interested in nn independent events. The probability that the ii-th event occurs is p_ip\_i. Yuuka is going to perform mm operations, each being one of the following:

  • "0 l_il\_i r_ir\_i": considering only the events from l_il\_i to r_ir\_i (both inclusive), find the probability that none of these events occur. As the value may be too small, you need to print the natural logarithm of the probability: if the probability is pp, print ln⁡(p)\ln(p).
  • "1 l_il\_i r_ir\_i k_ik\_i": for all l_i≤j≤r_il\_i \le j \le r\_i, multiply p_jp\_j by k_ik\_i. All events remain independent.

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains two integers nn and mm: the number of events and the number of operations (1≤n,m≤1051 \le n, m \le 10^5).

The second line contains nn real numbers p_1,p_2,…,p_np\_1, p\_2, \dots, p\_n where p_ip\_i is the probability that the ii-th event occurs (10−5≤p_i≤0.110^{-5} \le p\_i \le 0.1).

The following mm lines provide the descriptions of the operations. The ii-th line starts with an integer t_it\_i: the type of the corresponding operation. If t_it\_i is "0", it is followed by two integers l_il\_i and r_ir\_i. If t_it\_i is "1", it is followed by two integers l_il\_i and r_ir\_i, and a real number k_ik\_i (1≤l_i≤r_i≤n1 \le l\_i \le r\_i \le n, 0.0001≤k_i≤1000.0001 \le k\_i \le 100).

Each real number in the input has exactly five digits after the decimal point. Additionally, it is guaranteed that, at every moment, every p_ip\_i lies in the interval \[10−5,0.1]\[10^{-5}, 0.1].

It is guaranteed that neither the sum of all nn nor the sum of all mm will exceed 10510^5.

출력

For each operation of type "0", output a real number denoting the answer. Your answer will be considered correct if its relative error doesn't exceed 10−910^{-9}.

예제1

  1. 예제 1

    입력
    6 5
    0.01000 0.09871 0.00005 0.00999 0.01234 0.02345
    0 1 6
    1 3 4 10.00000
    0 1 6
    1 1 2 0.05000
    0 1 6
    
    예상 출력
    -0.16021487727848477000
    -0.25587417689480757000
    -0.14734347732072095000