Problem: http://www.spoj.com/problems/XMAX/
I got AC for one version that uses Reverse bidirectional iterators for sorting. http://ideone.com/l0StTQ
what I dont get is why am I getting WA with this code: http://ideone.com/cpYRbH
The only difference between the two is the kind of sort that I used
vector<int> a;
// initialization code
sort( a.rbegin(), a.rend() );
vs
vector<int> a;
// same initialization as above
sort(a.begin(), a.end(), comp);
where comp() is a boolean function given below
bool comp( int i, int j)
{
return i>j;
}