What if a car takes the side of its owner, Kim Pyojun?
InterviewTime limit1sMemory limit512 MB
For each window length k from 1 to N, find the starting index of the length-k subarray with the largest standard deviation, breaking ties by the smallest index.
- Level
Easy3 of 10
- Topics
- Array, Prefix sum, Brute force, Math
- Solved
- No attempts yet
Problem
A sequence of length is given. Write a program that does the following for in order.
- Let be the standard deviation of the length- interval starting at . Print the for which is largest. If there are several such , print the smallest one.
For example, if the sequence is and , the output is , because among intervals of length 2 the one with the largest standard deviation is .
Input
The first line gives the length of the sequence. ()
The second line gives the sequence . (, each is an integer)
Output
Print the value of for each over lines.
Hint
For data values ,
the mean is
the variance is
the standard deviation is .
Shortening "a car takes the side of its owner, Kim Pyojun" to four characters gives "standard deviation." (hehe;; sorry.. lol!!)