Shortest path in a unweighted graph(if many then lexicographically smallest)

Правка en1, от Zain-khatib, 2020-05-02 17:33:32

I tried to solve this problemproblem using BFS on priority queue with a custom comparator ,but getting WA ,and I really wanna know if the main idea is wrong or there is something in the code code ~~~~~ struct Compare { bool operator()(pair<string, int> const& p1, pair<string, int> const& p2) { if (p1.first.length() == p2.first.length()) return p1.first > p2.first; return p1.first.length() > p2.first.length(); } }; ~~~~~

Теги #graph, #bfs, lexicography

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Zain-khatib 2020-05-02 17:36:26 17 Tiny change: 'n\n~~~~~\nYour code here...\nstruct C' -> 'n\n~~~~~\n\nstruct C'
en3 Английский Zain-khatib 2020-05-02 17:36:10 241
en2 Английский Zain-khatib 2020-05-02 17:35:27 249
en1 Английский Zain-khatib 2020-05-02 17:33:32 597 Initial revision (published)