文章
34
粉丝
0
获赞
142
访问
4.5k
错误:
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 9;
struct Node{
int v, w, c;
bool operator < (const Node &other) const{
if(w != other.w) return w > other.w;
if(w == other.w) return c > other.c;
return v > other.v;
}
};
vector<Node> g[N];
int dis[N]; int cost[N];
bool vis[N];
int main() {
int n, m;
while(cin >> n >> m)
{
for(int i = 1; i <= n; i++) g[i].clear();
if(n == 0 && m == 0) break;
memset(dis, 0x3f, sizeof(dis));
memset(cost, 0x3f, sizeof(cost));
memset(vis, false, sizeof(vis));
for(int i = 1; i <= m; i ++)
{
int u, v, w, c; cin >> u >> v >> w >> c;
g[u].push_back({v, w, c}); g[v].push_back({u, w, c});
}
int s, e; cin >> s >> e;
priority_queue<Node> pq; pq.push({s, 0, 0});
dis[s] = 0; vis[s] = true; cos...
登录后发布评论
链接:https://www.nowcoder.com/practice/e372b623d0874ce2915c663d881a3ff2?tpId=63&tqId=29599&tPage=2&ru=/kaoyan/retest/9001&qru=/ta/zju-kaoyan/question-ranking