Hello everyone,
I am trying to solve this problem on topcoder ( SRM 678 div2 1000 ptr )
Not able to get the idea on how to solve!
Please help me in arriving at the solution !
Thanks in advance ! :)
EDIT : Anyone please?
№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hello everyone,
I am trying to solve this problem on topcoder ( SRM 678 div2 1000 ptr )
Not able to get the idea on how to solve!
Please help me in arriving at the solution !
Thanks in advance ! :)
EDIT : Anyone please?
Название |
---|
I'm not sure whether my solution is correct..
First consider if we can shift all these n-1 stairs, we will want to shift them averagely. So we can do a dp[now_stair][shifting_used], make sure that now_stair is not shifted. For transition we enumerate how many stairs after now_stair to be shifted, and shift them to average positions. The time complexity is O(n^4).
I didn't get you, Can you please explain?
Suppose we have 2 stairs, the bottom is 0, the top is 10, and we can shift both of the 2 stairs. Then shifting them to 0, 3, 6, 10 won't be worse than any other shiftings. Like this, in our shifting plan, a consecutive shifted stairs should be averagely placed between the stair before them and the stair after them. So we can use a dp to solve this.
The reason that the position should be chosen averagely is Lagrange Multipliers.