Codeforces Round #589 (Div. 2) Another Filling the Grid (dp)

NoSuchKey