PHYSICS - Editorial

@grayhathacker I Tried to IMplement Your Logic , Maybe You can figure where i am going wrong

I Figured It , This Line Had To Be Changed ā€¦
FROM
ans+=(bounds.second-bounds.first);
TO

ans+=((bounds.second-bounds.first)*((bounds.second-bounds.first)-1))/2LL;// C(N,2)

http://www.codechef.com/viewsolution/5633788

Your solution is even the better than the editorialistā€™s.

in the first approach explained in the editorial how it will give the correct answer if all the elements of the vector h are sameā€¦!!!..

@siddharth067 I didnā€™t understand why u did this ans+=((bounds.second-bounds.first)*((bounds.second-bounds.first)-1))/2LL;// C(N,2)