|
| Code Submission Evaluation System |
Login |
HIIT Open 2016
|
Start: | 2016-05-28 11:00:00 |
End: | 2016-05-28 16:00:00 |
|
|
Tasks | Messages | Scoreboard | Statistics
CSES - HIIT Open 2016 - ResultsHistory |
---|
2016-05-28 11:08:29 | ✓ |
Task: | Approximate |
Sender: | Game of Nolife |
Submission time: | 2016-05-28 11:08:29 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
Test results
test | verdict | time (s) | |
#1 | ACCEPTED | 0.18 / 1.00 | details |
Code
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
ld x[1010101];
ld xx[1010101];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,q;
cin>>n>>q;
for (int i=1;i<=n;i++) {
cin>>x[i];
xx[i]=x[i]*x[i];
x[i]+=x[i-1];
xx[i]+=xx[i-1];
}
cout<<setprecision(6)<<fixed;
for (int i=0;i<q;i++) {
int a,b;
cin>>a>>b;
ld y1=(x[b]-x[a-1])/(b-a+1);
ld y2=(xx[b]-xx[a-1])/(b-a+1);
cout<<y2-y1*y1<<"\n";
}
}
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100000 100000
62 64 35 47 57 38 52 4 56 13 7... |
correct output |
---|
831.753342
833.361649
833.847478
834.425131
831.468120
836.550284
840.319891
843.709808
830.097515
832.352323
828.549331
811.748878
833.912525
830.245034
831.485429
815.101051
834.579010
848.833782
839.942329
822.449380
... |
user output |
---|
831.753342
833.361649
833.847478
834.425131
831.468120
836.550284
840.319891
843.709808
830.097515
832.352323
828.549331
811.748878
833.912525
830.245034
831.485429
815.101051
834.579010
848.833782
839.942329
822.449380
... |