Strange behaviour in dp & bitmask problem — Codeforces 401D

Правка en1, от zoomer, 2015-08-14 07:20:31

I just got AC for this dynamic programming problem 401D - Roman and Numbers after many trials using recursion then loops..

I have faced some behaviour, which -in my opinion- is strange, and I can't figure out why it behaves like that :

  1. Declaring the dp array like this : dp[100][1<<18] gives a TLE. However, dp[1<<18][100] doesn't.
  2. using a long long for bitmask is slower than int! I know that 32bit integer would be sufficient for this problem, but I thought it would be safer to use long long.

I hope someone can explain it for me, thanks a lot :D

Теги dp, bitmask, arrays, data structures

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский zoomer 2015-08-14 07:26:41 18 (published)
en2 Английский zoomer 2015-08-14 07:24:41 43
en1 Английский zoomer 2015-08-14 07:20:31 624 Initial revision (saved to drafts)