Codeforces 1511 E. Colorings and Dominoes(DP)

NoSuchKey