vigroh_9's blog

By vigroh_9, history, 9 years ago, In English

Hello every one :D

How to solve this problem: Hashing: 2015-2016 ACM-ICPC, NEERC, Moscow Subregional Contest.

Thanks in advance.

  • Vote: I like it
  • +2
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

You need to remove no more than 256 numbers. Let's calculate dp[N][K], where N — current Index, K — count of deleted numbers.

dp[i+1][j] = max (dp[i+1][j], dp[i][j] + (a[i]^(i-j)));
dp[i+1][j+1] = max (dp[i+1][j+1], dp[i][j]);