vector、pair、auto用法
来源:互联网 发布:雪人信封打印软件 编辑:程序博客网 时间:2024/05/09 04:15
#include<bits/stdc++.h>using namespace std;const int maxn = 112345;const int INF = 0x3f3f3f3f;vector<pair<int,int> > edge[maxn];void Link(int st,int ed,int v){ edge[st].push_back(make_pair(ed,v));}int dis[maxn];bool vis[maxn];queue<int> Q;void spfa(int st){ while(Q.empty()==false) Q.pop(); memset(dis,0x3f,sizeof(dis)); memset(vis,0,sizeof(vis)); vis[st] = true; dis[st] = 0; Q.push(st); while(Q.empty() == false){ st = Q.front(); Q.pop(); vis[st] = false; for(auto it : edge[st]){ int ed = it.first; int v = it.second; if(dis[st] + v < dis[ed]){ dis[ed] = dis[st] + v; if(vis[ed] == false){ vis[ed] = true; Q.push(ed); } } } }}int main(){ int n,m; while(~scanf("%d %d",&n,&m)){ for(int i = 0 ; i <= n ; i ++) edge[n].clear(); int st,ed,v; while(m--){ scanf("%d %d %d",&st,&ed,&v); Link(st,ed,v); } spfa(1); } return 0;}
0 0
- vector、pair、auto用法
- C++ pair,map,vector简单用法
- pair用法
- pair用法
- pair用法
- vector存放pair对象
- vector pair sort
- vector持有pair模版
- 添加 auto vector 支持
- c++ vector中插入pair
- vector中pair的“>>”写法
- c++ vector pair 综合应用
- 关于c++ vector 插入pair
- STL的vector和pair
- C++ vector中使用pair
- VECTOR中pair的排序
- C++ pair用法
- 关于Pair的用法
- EventThread 详解
- iOS 实现数字动态变化的 UILabel:EFCountingLabel
- enote笔记语言(3)
- Spring AOP原理
- POJ 3984 迷宫问题 BFS DFS两种解法
- vector、pair、auto用法
- 使用Codeigniter重写insert方法
- 排队接水 洛谷p1223
- 7.标题:核桃的数量
- 关于如何取消匿名函数的绑定以及arguments.callee的用法
- Go实现具有并行度的锁
- html5学习笔记
- 1.26.3
- Leetcode 50. Pow(x, n)