Comments

Instead of direct solutions some hints would have been better.

Anyways nice problems and quick editorial! <3

0

Spent the whole time optimizing my indexed_multiset in C, only to realise just after the contest that binary searching the answer is sufficient. :( Nice bugaboos btw!

Logic of my submission is also similar, just instead of free bits I put 1 at each such position. Can it be hacked?

Travel parallel to x-axis first to reach the x coordinate and then travel parallel to y-axis or vice-versa to reach the final destination. This way it can be done in at max 2 moves

Can you please explain how that is fast enough in bit more detail

On cschill → Sharing my Happiness :), 5 years ago
0

Wonderful analogy!

No they wont be.

Why?

Hope it helps :)

No it is not necessary.

Reason

Actually it was not so unfair since you required just one observation for C.

Hint
Reason

Thanks for that

Same here. Tried different greedy approaches. Even my code works for the mentioned case. Sometimes you just dont know what you are missing. But yeah the brute force approach was cool.

Break condition is required when we have painted either all the rows or all the columns since after that final colour of a query would remain same.

Remember

Just naming a container as dp doesn't make the solution be a dp solution!

Was stuck in C for quite some time. Dropping by few hints for whosoever interested

Hint 1
Hint 2
Hint 3