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
@ bhanuagrawal
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.
Thanks for the explanation!
I did exactly the same as mentioned.But still getting the WA .
anyone could tell me why.?
here is the link to my solution
http://www.codechef.com/viewsolution/5152710
what is the answer to above example.?i.e the total number of combinations after modulo.?
anyone could please point out the mistake in my code ?
I am getting wrong answer again n again.
link to my solution -> http://www.codechef.com/viewsolution/5261675
anyone could please point out the mistake in my code ?
I am getting wrong answer again n again.
link to my solution -> http://www.codechef.com/viewsolution/5261675
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