题库练习 Mean Requests
← 上一题 下一题 →

A9813 | Mean Requests

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

The first line contains integer $n$ ( $1<=n<=2·10^{5}$ ), integer $T$ ( $1<=T<=n$ ) and real number $c$ ( $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 $c$ of the work of approximate algorithm. Number $c$ is given with exactly six digits after the decimal point.

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

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

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

输入格式

Print $m$ lines. The $j$ -th line must contain three numbers $real$ , $approx$ and $error$ , where:

- ![](/uploads/acgo/image/2b33c1ed396ed30f_87770194eee7.jpeg) is the real mean number of queries for the last $T$ seconds;
- $approx$ is calculated by the given algorithm and equals $mean$ at the moment of time $t=p_{j}$ (that is, after implementing the $p_{j}$ -th iteration of the cycle);
- ![](/uploads/acgo/image/e93c8635e177e5ba_14cf7282c6c3.jpeg) 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 $10^{-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
C++ 编辑器
输入
输出