CHEFFA - Editorial

yes its correct now

I understood one thing that these two arrays of length N - [0 0…1] and [1 0…0 0] are different. The f() for the first one will be phi^1 while for the second one will be phi^N. For the array of size N will have a non-zero element at nth pos. So, to minimise it make all element 0 and put 1 at the Nth element. This will ensure that the f() is calculated for an array of length N.

Any operation on array a doesnt change the value of f(a). I think it means that you cannot change the length of the array ‘a’ more than log(f(a)).
log(f(a)) - gives a number which is the max length possible for the given array.

1 Like

“on the subarray starting from the element having index pos assuming that this element was changed by deltapos and the next element to the right was changed by deltanxt.” Can somebody please explain this to me?

@underdog_eagle: I don’t have a specific set of problems. If you see Topcoder Div 2 hard problems, you will set a lot of such examples of dp problems, which require multiple dimensions in the state.

Sleek trick! I love it even more because it uses phi and the problem is called Fibonacci Array.

There is a reason for the problem to be called “Fibonacci Array” - if all n members of the initial array are equal to 1 then the answer will be the n-th fibonacci number.

2 Likes

div2 hard mean div2 1000 pointers or anything else?

Yes, div 2 1000 level problems.

1 Like

I used two 2d arrays instead.
https://www.codechef.com/viewsolution/14980893

Can you please tell me, how do you approach such a DP problems with such a lenient solution in one go?

I mean what type of technique do you follow in solving these ones?

Shoudn’t it be: dp[pos][deltapos][deltanxt] += dp[pos+1][deltanxt-op][op]?

Also, I think there shouldn’t be a +1 here: 0 ≤ op ≤ min(arrpos+deltapos , arrnxt+deltanxt) + 1 (in the two places where it appears).

Editorial lacks clarity. A lot of things are unexplained.

1 Like

Access denied for author’s,tester’s and editorialist’s code @dpraveen

access denied to all the solutuion . also can’t see the code of @dpraveen