Comments

Nice explanation!

On Sulfox → Codeforces Round #635, 6 years ago
0

labels are: 4, 6, 9, 7, 8, 10, 11

In problem MORALE99, the output of following test case should be 2.
7 3 4
1 1 0 0 1 1 2
but this accepted submission gives 1 as output.

I have understood the case when sequence contains 2. If there is no 2 in sequence, how can you change 1 to 0 and 3 to 1?

On retired_ → Need help in a DP problem, 7 years ago
0

Thank you! As per the editorial of this problem we can use CHT to optimize DP.
I guess i need to learn how to use CHT first.

On retired_ → Need help in a DP problem, 7 years ago
0

I think you misunderstood the problem.
If we have given money to some agent and bought a house from him then we don't have to pay him again if we buy another house lying in that agents' range. Although we may have to pay some other agents who are also selling that new house.

If there are no A's then you can not convert the matrix, so answer for this case is 'MORTAL'. otherwise, check for each row and column whether you can convert this row or column into all A's. If yes, then using this row or column you can convert entire matrix into A's. Take minimum at every step.

Can someone share their approach for Div2 E ?