Need help understanding problem 276D

Revision en1, by I_AM_SHY, 2017-04-04 11:18:49

Hi everyone, I was solving problem http://codeforces.me/problemset/problem/276/D. I understood that there are two ways to get the answer. I am interested in understanding the dynamic programming solution mentioned in the tutorial here: http://codeforces.me/blog/entry/6779 I am unable to understand the authors explanation. I even tried working through the code but i could not understand the solution. Could somebody please explain the DP solution? What is the state? What are the transitions and how do they work? Why does the author add (1<<s1.size()-p-1) instead of (1<<p)? Your help will be highly appreciated.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English I_AM_SHY 2017-04-04 11:18:49 659 Initial revision (published)