GiantTornado's blog

By GiantTornado, history, 5 years ago, In English

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?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 years ago, # |
  Vote: I like it +1 Vote: I do not like it

It's about cache optimization.

https://codeforces.net/blog/entry/69685