1

Educational Codeforces Round 165 Editorial

 2 weeks ago
source link: https://codeforces.com/blog/entry/129022
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
By awoo, history, 8 hours ago, translation, In English

1969A - Two Friends

Idea: BledDest

Tutorial
Solution (awoo)

1969B - Shifts and Sorting

Idea: BledDest

Tutorial
Solution (adedalic)

1969C - Minimizing the Sum

Idea: BledDest

Tutorial
Solution (Neon)

1969D - Shop Game

Idea: BledDest

Tutorial
Solution (Neon)

1969E - Unique Array

Idea: BledDest

Tutorial
Solution (Neon)

1969F - Card Pairing

Idea: BledDest

Tutorial
Solution (BledDest)

5 hours ago, # |

Good editorial, but for problem C I have a question, If we increase K to a number M. Which is the maximum value that M can achieve auch that there exist a solution that fits in 5 seconds?

5 hours ago, # |

I think I have another solution for D: 258763428

But, I am not sure why it works :)

3 hours ago, # |

About problem F: How do you handle the case, when the deck becomes empty and we still have duplicate cards on the hand? How do you choose the pair to go with?

  • 40 minutes ago, # ^ |

    This is handled by the fact that the dynamic programming stores the number of pairs we "broke" instead of the number of pairs we made, and it is subtracted from the number of pairs we can make from a sequence of cards in the best case scenario (i. e. if we could pair any two cards without having both of them in hand at the same time). The value in dp increases by 11 every time we play a non-paired card such that the remaining number of cards of that type is odd, since it means that the number of pairs we could possibly make with that type of card decreases by 11.

    So, the pairs that are left in our hand after we've drawn the whole deck are simply not counted as "broken", we don't subtract them from the number of possible pairs we can make.

11 minutes ago, # |

Mad respect to everyone who did a O(n2)O(n2) for F


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK