Summary of the shortest circuit

Source: Internet
Author: User

The most recent short-circuit problem summed up a little, by the way to write a template, the shortest path algorithm many have Floyd, Dij, Bell-man, SPFA, the fastest is dij+ priority queue or dij+ heap sorting, SPFA in theory very soon O (ke) but the actual is not necessarily but SPFA legend has a very NB use is to deal with negative power loop.

adjacency table vs adjacency Matrix: Based on the experience of writing a problem, if you can use a matrix that must be preferred, the matrix speed is faster than the table and the topic appears multiple edges when the matrix is well solved.          today accidentally met the forward table and the shortest-circuit diagram (HDU2433), feeling very excited ha, the night brush the feeling of the problem is very fun! Unfortunately, hdu1385 has not been, it is a problem of the shortest path problems, such as write again to update it, a short way to write a little bit of a long time to summarize, today is all night to summarize, because it has been a day to drag the day. After the shortest short write immediately need to start to see a number of rounds and mathematical materials, light brush water problem to improve very slowly. Shortest: http://acm.hdu.edu.cn/showproblem.php?pid=1596 (medium) http://acm.hdu.edu.cn/showproblem.php?pid=2433 (slightly difficult) http:/ /acm.hdu.edu.cn/showproblem.php?pid=2112 (Base) http://acm.hdu.edu.cn/showproblem.php?pid=1874 (base)/HTTP// acm.hdu.edu.cn/showproblem.php?pid=2544 (Base) http://acm.hdu.edu.cn/showproblem.php?pid=2680 (medium)/HTTP// acm.hdu.edu.cn/showproblem.php?pid=2647 (slightly harder) http://acm.hdu.edu.cn/showproblem.php?pid=1690 (medium) Topology sort:/http acm.hdu.edu.cn/showproblem.php?pid=3342 (base) http://acm.hdu.edu.cn/showproblem.php?pid=1285 (slightly difficult) shortest circuit template (complexity O (NLOGN) ) dij+ priority Queue:hdu1690#include<stdio.h> #include <queue> #include <string.h> #define INF 10000000000000using namespace Std;__int64 mp[101][101];__int64 d[101];bool hash[101];__int64 a[101];__int64 l1,l2,l3, L4,C1,C2,c3,c4;__int64 n,m;__int64 start,end;typedef struct node{                __int64 Adj;    __int64 w;    struct Node*next;} node,*pnode;typedef struct Heap{    bool operator< (Heap T) const    {         return t.dis<dis;    }     __int64 x;    __int64 Dis;} Heap;priority_queue

Summary of the shortest circuit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.