Hello, Good people. Hope you all are doing well. I am trying to solve the problem for a while but didnt come up any idea. Can anyone tell me how can I solve this problem?
Problem Link: https://vjudge.net/problem/Gym-100625J 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 | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Hello, Good people. Hope you all are doing well. I am trying to solve the problem for a while but didnt come up any idea. Can anyone tell me how can I solve this problem?
Problem Link: https://vjudge.net/problem/Gym-100625J Thanks in advance. :)
Name |
---|
Why downvote? If you cant help just ignore this.
Thats because some people love to downvote newbie's blogs .. If the same blog was written by a person with rating 1900+ this wont happen .. That's the thing which I hate the most on codeforces.
The idea is considering the outside of the building in the grid. So you can use 0/1 bfs to find the shortest path from the outside to any cell (every door cost 1 and the empty space cost 0), and from any prisoner to every cell. Then, to find the answer you can iterate over all the cells. Take in mind that if your cell is a wall, skip this. If it's a door, the answer is the sum of the 3 distances — 2 (because your considering 3 times this cell and you only need to consider one) and if it's the empty cell is just the sum of the 3 distances (with 3 distances I mean, the distance from the outside and the two prisoners to every cell). I hope it helps.