SAS001 - Apoorv and Maximum Inversion
Apoorv has an array of n integers.Inversion count of an array is defined by number of pair of indices(i,j) such that i<j and arr[i]>arr[j] .You are given an integer p.Apoorv has to find the subarray with maximum inversion count among all subarrays of size p.Apoorv find this job very tough so he turns to you for help.
First line contains two integers n and p.
Next line contains n space separated integers denoting the elements of the array.
Output two space separated integers first integer should be the starting index (1-based indexing) of the subarray and next integer would be the count of inversions in that subarray.In case there is a tie in maximum inversion count print the smallest starting index among the subarrays having maximum inversion count.
Input: 10 5 15 51 44 44 76 50 29 88 48 50 Output: 5 6
Nice problem :) sas1905 _/\_
My 175 on spoj :)
Segment tree + sliding window... try the problem "Inversion Count" in SPOJ before solving this.. that will be of great help ..HAPPY CODING! :D
sas pro! Nice problem.. :)
Sas pro!! _/\_
Nice question! Sas pro! _/\_
Nice problem :)
Nice one ;)
Awesome problem :D