It’s not an optimized code but i solved it using Python and got 10 pts but when i submit using the same logic using C++ i got Wrong Answer(WA). Here’s my code using c++. and accepted python
(http://www.codechef.com/viewsolution/5318058) 10 pts.
I dont know what's wrong with my c++ code. Please help me.
1 Like
Use long long. In the worst case, all the functions are from 1 to n and each query can have a maximum answer of 10^3 (1…n) * 10^9 (each element) * 10^3 (functions 1…n). Unsigned long isn’t sufficient to hold 10^15.
1 Like
use long long int… python does not care about data types. It can handle bigger calculations with int datatype.
But C++ have data type limits defined.
1 Like
I tried changing the data types still WA.
Don’t know why.