cf 707B
来源:互联网 发布:java 通用excel导出 编辑:程序博客网 时间:2024/05/21 11:23
点击打开链接
水题,跑一边记录最短的就行了,
wa一次, 忽略两个都不能建的情况。
#include <stdio.h>#include <string.h>#include <iostream>#include <map>#include <math.h>#define LL long longusing namespace std;const int maxn=1e5+10;const int mod=1e9+7;int n,m,k,x,y,len,cnt=0;struct node{ int w,to,val;}edge[maxn*2];int v[maxn],a[maxn];int main(){ scanf("%d %d %d",&k,&n,&m); for(int i=0;i<n;++i){ scanf("%d %d %d",&edge[i].w,&edge[i].to,&edge[i].val); } int mina=1e9+1; for(int i=0;i<m;++i){ scanf("%d",&a[i]); v[a[i]]=1; } for(int i=0;i<n;++i) if(v[edge[i].w]^v[edge[i].to]&&edge[i].val<mina) mina=edge[i].val; if(mina==1e9+1) mina=-1; printf("%d\n",mina); return 0;}
0 0
- cf 707B Bakery
- cf 707B
- cf-B
- cf B
- CF 1B Spreadsheet
- CF 3B Lorry
- CF 176B
- CF 91B
- cf 131 DIV2 B
- CF 113B || CF196D
- CF 126B
- CF-236B
- CF 254B(日期)
- cf 79B
- CF - 158B - Taxi
- CF 296B
- CF 173(div2) B
- cf:B-QR code
- 大众点评点餐小程序开发经验
- 3.12
- SSH Secure Shell登录报错: Ubuntu SSH Algorithm negotiation failed
- 原来jQuery选中第一个option这么简单
- 枚举窗口
- cf 707B
- Oracle各版本下载地址
- HDU1166_敌兵布阵_线段树单点修改区间查询
- MySQL系统变量、自定义变量和存储程序变量使用小结
- 华为机试题11-20
- &运算符的应用
- C++--STL-string容器的使用,学习代码
- 设计模式----行为型模式之观察者模式(Observer Pattern)
- java入门