Editorial for COCI '20 Contest 3 #4 Selotejp
Submitting an official solution before solving the problem yourself is a bannable offence.
This is a maximum bipartite matching problem. Don't let anyone convince you this is dynamic programming.
See https://codeforces.com/contest/1404/problem/E.
We solve the task using dynamic programming. The state is the row and column of the current square, and a bitmask that represents what happened on the last
The current square is colored red, and other squares that are represented in the bitmask are colored blue. Let bit
The transitions are:
if bits corresponding to the current and the left square are both :if the bit corresponding to the current square is , and the left square doesn't exist or its bit is equal to :and if equals , we do the transition using .if the bit corresponding to the current square is :
We also need to take care of the open squares, we can't continue to use a piece that covers one of them. The complexity is
Comments