No, Test cases cannot be shared, as per codechef rules. You can see detailed discussion or put forward your views if you wish to, at link below.
https://discuss.codechef.com/questions/7509/link-to-test-cases-after-contests
No, Test cases cannot be shared, as per codechef rules. You can see detailed discussion or put forward your views if you wish to, at link below.
https://discuss.codechef.com/questions/7509/link-to-test-cases-after-contests
I submitted your code in practice, and it got AC. This is a known problem.
https://discuss.codechef.com/questions/136250/wa-in-contest-ac-in-practice
Your solution tries to iterate over range of size up to 1e9, which cannot be completed in one second. Assume 1e7 iteration can be done in one second.
For a binary search solution, you may refer any solution in practice using binary search. I found this solution, doing binary search using lower_bound function.
Offline mode means we read all queries first, answering them in some specific order and printing answers according to their order in input.
So why my solution got WA for rest of 70 points during the contest.
You’re passing on the vector in int binarysearch(vector<pair<ll,ll> > v1,ll l,ll r,ll key)
by value, so you copy a vector of pairs for every single call to binary search. Make that a reference int binarysearch(vector<pair<ll,ll> > &v1,ll l,ll r,ll key)
and you should get decent running times.
You’re passing the vector by value in your binary search. That by itself is O(n). Pass it by reference.
Can anyone help me with the code , it is giving runtime
Does anybody know why my code in the second subtask gives a wrong answer((even though it is correct in the first one)? I used Python
https://www.codechef.com/viewsolution/71502253