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 | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | 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 | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
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