Topcoder SRM 576

I have never performed well in any early morning SRM, and today wasn’t any different. So I will skip any commentary and get straight to solutions that I could figure…

DIV-2 Easy; TheExperimentDiv2:

There are N droppers hanging from a ceiling numbered 0 to N-1, each dropping intensity[i] drops per minute. There are M sponges numbered 0 to M-1, each at a distance of (i+1)cm from the ceiling. Each sponge has length L, and its left end is at distance leftEnd[i] from wall of the room. Any drop that falls on a sponge, is completely absorbed. We have to find out how many drops each sponge absorbs per minute.

For each dropper, we need to find out which sponge will receive its drop at first. Any sponge that does, will have intensity of that dropper added to its total drops per minute absorption

DIV-2 Medium; ArcadeManao: 

This problem requires us to travel through a grid of NxM cells, and reach a particular cell grid[coinRow][coinColumn], where we start at the bottom of the grid, and can only reach an upper row if we have a ladder of L such that our current row + L can take us to our desired upper row. Of course we can only go to a cell which has a platform and isn’t empty.

Since N and M can be at most 50, and bottom row is a complete platform, we can always reach our desired cell. What we need to find out is the minimum ladder length with which it is possible to do so. We can iterate over lengths of ladder from 0 to 50, and find out if it is possible to reach our destination cell from bottom row using this ladder, using depth/breadth first search.

Be Sociable, Share!

Leave a Reply