突然觉得堆优化$O(log_n)$的复杂度很优啊,然而第n次忘记了$Dijistra$怎么写QAQ发现之前都是用的手写堆,这次用一下$stl$ #include<bits/stdc++.h> #define LL long long using namespace std; int n, m; struct Node { int v, nex, w; Node(, , ) : v(v), nex(nex), w(w) { } } Edge[]; ], stot; void add(int u,
朴素Dijkstra #include<bits/stdc++.h> using namespace std; const int inf=9999999; bool book[105]; int mp[105][105]; int dis[105]; int n,m; void Dijkstra(int s){ int start=s; memset(dis,inf,sizeof(dis)); book[s]=1; for(int i=1;i<=n;i++) dis[i]=min(di
1674: [Usaco2005]Part Acquisition Time Limit: 5 Sec Memory Limit: 64 MB Description The cows have been sent on a mission through space to acquire a new milking machine for their barn. They are flying through a cluster of stars containing N (1 <= N <