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)