Educational Codeforces Round 150 Editorial
source link: https://codeforces.com/blog/entry/117262
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.
Educational Codeforces Round 150 Editorial
Idea: BledDest
Idea: BledDest
Idea: BledDest
Idea: BledDest
Idea: BledDest
1841F - Monocarp and a Strategic Game
Idea: TheWayISteppedOutTheCar and BledDest
I am facing time-limit-exceeded in test-case3 Problem B solution |
I have made a detailed video (its in hindi language) to solve problem C using 3 different approaches. Video link : link Let me know if it helps you :) |
I'm going to share some of my solutions since they are not mentioned in the editorial. For 1841C - Ranom Numbers, I basically did some sort of brute force, checking every possible replacement for a character and taking the maximum. The trick is that when you decrease a character, some of the characters that are directly affected by you may not be affected anymore (or may be affected by some other letter on the right of the current letter), and when you increase a character, some of the characters are before you and not affected by anybody may be affected by you. To check this, I made a vector called For 1841D - Pairs of Segments, I sorted according to the left boundary (and so let Now, use Dynamic Programming where and then we basically try to minimize with For 1841E - Fill the Matrix, I used the same general idea: we just collect all contiguous segments in the same row in the matrix by considering from the bottom row to the top row and noting that some of the black towers split some segments in two. However, I feel my implementation was a bit simpler, it was using an idea called deltaing that I learned from Algorithms Live's amazing episode 9: "Solution Bags". The idea is to maintain
Now, we loop on row Suppose that a black cell appears at index
After we're done we basically have the frequency of each size of a segment, and we can just loop greedily from the largest segment to the smallest segment and fill as much as we can with our |
-
I tried the similar approach in which for every index I checked how the initial sum is affected if I changed the particular index. But for reducing time I precomputed the initial sum, frequency of character before the particular index, and after the index and tried to make changes on that so if I had changed that to particular character then how it might affect the initial sum. But I was not able to get it right :( 209557678
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK