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?
It's about cache optimization.
https://mirror.codeforces.com/blog/entry/69685
Thank you