C vs C++ for XRQRS

I submitted a solution for XRQRS in C which showed TLE in last test case of first subtask:

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

and the same problem when submitted in C++ gave me AC:

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

Maybe it is because of the difference between the complexities of qsort and sort library functions in c and c++, but I am not sure. Can someone explain this?

Same happened with me :p!

More than the difference between complexities of qsort and sort, cpp might have higher time limit by some factor than C

Performance of qsort vs std::sort C & C++

Same happened with me…resulted in 7 TLE’s…

C compiler=>You will get benefit in terms of memory complexity.

C++ compiler=>Because of the implementations in algorithm header file You will get benefit in terms of time complexity.