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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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