FATCHEF-Editorial

Edit:- beroul has pointed out my mistake. There is no flaw in the answer.

I think this answer has a flaw.

If you consider 1000200030004 as input(as used in the editorial).

If some point between first and fifth is coloured 2, it means it can only be start or end.

Space between bucket is used in following lines, for 1 and 2 it refers to the zeros at positions 2nd,3rd,4th

It means that there can only be 2 gaps between buckets, which are coloured with colours on either side buckets.

But, this answer assumes that 1111223333444 is possible, which is having 3 spaces between buckets.


I tried to ask about this via comment but there was no reply from admin.

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 β†’ CodeChef: Practical coding for everyone

prob with code , gives WA . please point out :

https://code.hackerearth.com/12ad60I

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

It’s a good question on combinatorics :slight_smile:

I did the same thing as mentioned here . Still I was getting TLE . It would be great if someone points out the mistake in the given code.

http://www.codechef.com/viewsolution/5123371

why wrong answer???
http://www.codechef.com/viewsolution/5064542

For java , time limit was too strict. I submitted the same code in C and it was accepted. Why so?

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