Any Idea of how to solve this problem ?? https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=592&page=show_problem&problem=4768
№ | Пользователь | Рейтинг |
---|---|---|
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 |
Any Idea of how to solve this problem ?? https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=592&page=show_problem&problem=4768
Название |
---|
Do YOU have any ideas about how to solve this problem? You should always write them when you ask a question (if you care about those who will spend time explaining you the solution).
BTW, the problem can be reduced to an ordinary Dijkstra's algorithm. This answer is as detailed as your question :).
well i tried to use Dijkstra but because the query number is very high it gave TLE
so it is clearly not useful to mention it, because it was week solution.
You're lazy to explain even how did you build the graph on which you ran Dijkstra, but still want to others to explain you the complete solution. It's an egoistic behaviour...
If your solution is correct, but too slow, it can be improved to get AC. And the process of step-by-step improvement will help you to develop your competitive programming skills (and not only them).
I don't mind to help you, but a teacher's job is not to give the learner the complete solution, but to point the learner to the correct direction. Thank you for your understanding.
Very nice problem indeed!
A little hint: Try to work with edges instead of nodes. That is, compute shortest path that ends in a certain edge instead of a certain node, and make an adjacency list for the edges instead of the nodes.