Hello to all,today I solve problem A. Greg and Array and I have and misunderstanding: I have two submission,one get accepted and another get wrong answer on test 11.
the difference between this both submission is the line below:
for (i=1;i<=n;i++) dp[i]=dp[i]+dp[i-1];
if I change n with m
I get Accepted,Can someone explain me why,I didn't use element on position bigger than m
and I didn't exceed the limits of the array dp
???
I'm very interesting why this happens,because during the contest this mistake can cost me one problem.
You use
dp
for values up to m right in the next loop: