CSES - HIIT Open 2016 - Results
Submission details
Task:Approximate
Sender:Verto
Submission time:2016-05-28 11:25:47 +0300
Language:Python2
Status:READY
Result:
Test results
testverdicttime
#1--details

Code

import sys

lines = sys.stdin.readlines()

def asints(s):
	return [int(x.strip()) for x in s.split()]

n, q = asints(lines[0])
sequence = asints(lines[1])

for i in range(2, q + 2):
	low, high = asints(lines[i])
	subs = sequence[low-1:high]
	avg = sum(subs) *1.0 / len(subs)
	errs = [(x*1.0-avg)**2 for x in subs]
	print sum(errs) / len(errs)
	

Test details

Test 1

Verdict:

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
...

user output
(empty)