- Time limit: 1.00 s
- Memory limit: 512 MB
You are given an array of integers. For each , your task is to find the subarray ending at index with the largest average. If there are multiple subarrays with the largest average, you should find the longest one.
Input
The first line has an integer : the size of the array.
The next line has integers : the contents of the array.
Output
Print integers: the length of the subarray ending at index with the largest average for each .
Constraints
Example
Input:
7 1 6 4 6 2 5 5
Output:
1 1 2 1 4 1 2
Explanation: Consider . The averages of all subarrays ending at index are , , , and . The largest average is and the length of the corresponding subarray is .