How to solve this problem ? I cant even understand the sample input. asked 26 May '17, 18:25

This is a DP problem. Since a and b can be atmost 10^5 and k is fixed you can precompute all values upto 10^5 . For i< k dp[i] is 1 and for i>=k you can add a R or W at the end. If you add R the previous value can be R or W.If you add a zero the previous k1 must be zero for valid configuration. So dp[i]=dp[i1]+dp[k1]. answered 27 May '17, 10:20

Can someone help me please ? answered 27 May '17, 08:50
Read the editorial here : http://codeforces.com/blog/entry/14136
(27 May '17, 11:23)
