FATCHEF-Editorial

I took the same approach and got TLE. CodeChef: Practical coding for everyone

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.

1 Like

Yes you have to use fast read. see http://discuss.codechef.com/questions/7394/help-on-fast-inputoutput
Also see here (my solution including some code NOT FROM ME for fast intput): CodeChef: Practical coding for everyone

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

2 Likes

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

@ bhanuagrawal

I just checked your code and find the following things wrong with your code .

  1. 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.

1 Like

Thanks for the explanation! :slight_smile:

Can you help me with error in this code CodeChef: Practical coding for everyone
Thanks.

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