https://www.codechef.com/viewsolution/33063445
I had to use the hints to solve the problem and I just explored the upper_bound and lower_bound functions so not sure what I am doing wrong. Please help
Try :
2 2 3
7 1000
1 10
2 7
3 4 10
2 Likes
You are not first checking condition. In case for lower_bound if all the elements in the range compare less than val, the function returns last. If all the elements in the range are larger than val, the function returns a pointer to the first element.
if (contest[i].first >= v[0] && contest[i].second <= w[y-1])
1 Like