fatchef oct14

i applied the same logic as given in oct14 challenge fatchef editorial…
why i m getting “wrong answer”?can any1 help me out…the following is link to my soln.
http://www.codechef.com/viewsolution/5143460

1 Like

Use long for fencolor and take modulo as follows

fencolor=((fencolor%mo)*(a[i].plank-a[i-1].plank)%mo)%mo;

Here is the accepted and corrected solution of your code

3 Likes

Why my solution is giving TLE even if i have solved in O(n)… Please help me .Here’s the code:
http://www.codechef.com/viewsolution/5095572

@rkm_coder Check This. It is the AC version of your code. I used fast I/O implementation from here.

1 Like