Hi there!
Today at 04:00 MSK will be held Topcoder SRM 659.
Let's discuss problems after contest.
Editorial for problems.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi there!
Today at 04:00 MSK will be held Topcoder SRM 659.
Let's discuss problems after contest.
Editorial for problems.
Name |
---|
Is there anyone who solved Div. 1 Medium with complexity better than O(n * 3m)?
Sure, O(nm2m).
Wait, can you actually make that pass?
Edit: Ignore that, it is discussed in the editorial blog.
Can you please explain any of the states that have been discussed in the editorial?
I find it easier to think in terms of a n × m grid. You are supposed to place a 1 × 2 tile or 1 × 1 tile or cover two cells of the same colour in adjacent rows, and we have to find the number of ways to tile the grid. You just run across the grid in row-wise order choosing how the next cell is tiled. If we choose the special tiling(same colour in adjacent rows), then we have to remember to not tile the next occurrence of this colour(that is, the occurence in the next row). So, it is natural to keep a set(a bitmask) of the colours that we have to ignore as we run across. So, the dp state is (x, y, colours that you ignore). Now, if the next cell is one of the colours that I ignore, update the set and continue forward. Otherwise, we choose how to tile the current cell. If it is going to be tiled by a 1 × 1 tile, you continue forward. If it is a special tile, you update the set asking to ignore the next occurrence of this colour. Finally, if it is a 1 × 2 tile, you have to make sure that the next 2 cells(the current one and the next one) are in the same row and that you cannot ignore the next 2 cells. If so, tile that way. Check out Endagorion's clear implementation for the same.
Thanks for your amazing explanation!
Does anyone know where can I find topcoder SRM editorials? I searched exhaustively with no success.
http://apps.topcoder.com/wiki/display/tc/Algorithm+Problem+Set+Analysis
I found this page but I was getting an error when I tried to login to see it. Now I logged in on another page and could access it. But thanks anyway!