Hello all. I am currently having trouble understanding the DP approach to solving problem 452D. I have read a few of the solutions but I fail to understand why they work.
Thanks in advance. :)
# | 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 | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Hello all. I am currently having trouble understanding the DP approach to solving problem 452D. I have read a few of the solutions but I fail to understand why they work.
Thanks in advance. :)
Name |
---|
nobody cares
Wow, what an asshole, Bredor. Taco, I really hope you aren't put off of the entire community because of people like him. Personally, I didn't actually use a DP, I went with a greedy. Would you like me to explain that one or are you going for the DP specifically? BTW, as a fellow fan of tacos al pastor, nice username. :)
Well the idea is quite simple, since k = 10^4 and there are only 3 thing to do you can simulate all the process, you just need to store the time where each laundry piece is ready w[] and the time where each machine is ready time_m[]. At the beginning each w[] and time_w[] will be 0, Now for each process wash,dry,fold (lets index with j) the time where the i-th piece of laundry is ready is after the piece is ready or the machine that will serve this piece (which is i%n[j]) is ready plus the time to be served, I mean w[i] = time_m[i%n[j]] = max(time_m[i%n[j]],w[i])+t[j]. Finally the answer is the max element of w, which is w[k]. Hope I have explained it clearly. my submission during contest