anyone could please point out the mistake in my code ?
I am getting wrong answer again n again.
link to my solution β CodeChef: Practical coding for everyone
I didnβt use Fast I/O being a java user.Instead I did an optimization i.e start from the minimum position(which is painted) and go till Max Position(which is painted).
Hope that helps.
Here is my
[1] for reference.
[1]: https://www.codechef.com/viewsolution/15878434
Please refrain from posting your code here. Either link to your submission or explain how you approached the problem. If you do need to post a code snippet, format it properly.
start at the most left point (βbucket 1β), go to the most right point (bucket β4β)
go from bucket β4β to bucket bucket β3β
then 1 step to the right
then back to bucket 3 then go to bucket β2β
then 1 step to the right
then go to bucket β1β
then 3 step to the right
This question needs faster input/output methods. Use scanf/printf or else if u want to continue using cin and cout add this line std::ios::sync_with_stdio(false); under the int main line
Even you need a faster input output method. This question has many inputs. cin and cout are slow. Use scanf/printf or else if u want to continue using cin and cout add this line std::ios::sync_with_stdio(false); under the int main line
I just checked your code and find the following things wrong with your code .
first of all read the problem statement carefully. you need to output the answer mod 10^9+9 because number of arrangements may be very large. you have not used mod any where in your code.
Second thing your array size is exactly 10^5 and you are using 1 based indexing. In c and c++ 0 based indexing is used. so your array actual index is from 0 to 99999 and you are trying to access 1 to 10^5.
anyone could please point out the mistake in my code ?
I am getting wrong answer again n again.
link to my solution β CodeChef: Practical coding for everyone