Why???

Revision en4, by Omega1, 2015-10-12 17:16:48

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.

Accepted

Wrong answer

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Omega1 2015-10-12 17:16:48 49
en3 English Omega1 2015-10-12 17:14:03 49
en2 English Omega1 2015-10-12 17:03:44 1 Tiny change: '\nI have to submissi' -> '\nI have two submissi'
en1 English Omega1 2015-10-12 16:59:47 679 Initial revision (published)