TLE and when changing only the ordering of states got AC

Revision en1, by GiantTornado, 2020-02-05 14:31:59

Hello guys, I've recently solved this problem 628D - Magic Numbers by defining a dp array dp[b.length][m][2][2] and got TLE,

i used the exact same code with a different ordering of states dp[2][2][b.length][m] and got accepted.

These are my submissions you can compare them to check that nothing is different except the ordering of states in dp array : 70233950 70235256

why this happened?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English GiantTornado 2020-02-05 14:31:59 487 Initial revision (published)