CF523B.Mean Requests

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains integer nn ( 1<=n<=21051<=n<=2·10^{5} ), integer TT ( 1<=T<=n1<=T<=n ) and real number cc ( 1<c<=100 ) — the time range when the resource should work, the length of the time range during which we need the mean number of requests and the coefficient cc of the work of approximate algorithm. Number cc is given with exactly six digits after the decimal point.

The next line contains nn integers ata_{t} ( 1<=at<=1061<=a_{t}<=10^{6} ) — the number of queries to the service at each moment of time.

The next line contains integer mm ( 1<=m<=n1<=m<=n ) — the number of moments of time when we are interested in the mean number of queries for the last TT seconds.

The next line contains mm integers pjp_{j} ( T<=pj<=nT<=p_{j}<=n ), representing another moment of time for which we need statistics. Moments pjp_{j} are strictly increasing.

输入格式

Print mm lines. The jj -th line must contain three numbers realreal , approxapprox and errorerror , where:

  • is the real mean number of queries for the last TT seconds;
  • approxapprox is calculated by the given algorithm and equals meanmean at the moment of time t=pjt=p_{j} (that is, after implementing the pjp_{j} -th iteration of the cycle);
  • is the relative error of the approximate algorithm.

The numbers you printed will be compared to the correct numbers with the relative or absolute error 10410^{-4} . It is recommended to print the numbers with at least five digits after the decimal point.

输出格式

输入输出样例

  • 输入#1

    1 1 2.000000
    1
    1
    1
    

    输出#1

    1.000000 0.500000 0.500000
    
  • 输入#2

    11 4 1.250000
    9 11 7 5 15 6 6 6 6 6 6
    8
    4 5 6 7 8 9 10 11
    

    输出#2

    8.000000 4.449600 0.443800
    9.500000 6.559680 0.309507
    8.250000 6.447744 0.218455
    8.000000 6.358195 0.205226
    8.250000 6.286556 0.237993
    6.000000 6.229245 0.038207
    6.000000 6.183396 0.030566
    6.000000 6.146717 0.024453
    
  • 输入#3

    13 4 1.250000
    3 3 3 3 3 20 3 3 3 3 3 3 3
    10
    4 5 6 7 8 9 10 11 12 13
    

    输出#3

    3.000000 1.771200 0.409600
    3.000000 2.016960 0.327680
    7.250000 5.613568 0.225715
    7.250000 5.090854 0.297813
    7.250000 4.672684 0.355492
    7.250000 4.338147 0.401635
    3.000000 4.070517 0.356839
    3.000000 3.856414 0.285471
    3.000000 3.685131 0.228377
    3.000000 3.548105 0.182702
    
首页