ccf 送货
来源:互联网 发布:药品条形码数据库 编辑:程序博客网 时间:2024/04/30 05:17
#include<iostream>#include<cstring>#include<cstdio>#include<queue>#include<vector>using namespace std;vector<int> a[1001];int main(){int n,m,x,y,count=0;scanf("%d%d",&n,&m);memset(a,0,sizeof(a));for(int i=0;i<m;i++){scanf("%d%d",&x,&y);a[x][y]=a[y][x]=1;}int path[10001],k=1;queue<int> q;q.push(1);path[0]=1;while(!q.empty()){int tmp=q.front();q.pop();for(int i=1;i<=n;i++){if(a[tmp][i]){a[tmp][i]=a[i][tmp]=0;count++;path[k++]=i;q.push(i);break; }}}if(count==m){cout<<path[0];for(int i=1;i<k;i++){cout<<' '<<path[i];}cout<<endl; }else{cout<<-1<<endl;}return 0;}
0 0
- ccf 送货
- ccf 送货
- ccf送货
- ccf 送货
- CCF 送货
- CCF送货
- CCF 送货
- CCF认证 送货
- CCF 201512-4 送货
- ccf 201512-4 送货
- CCF送货(欧拉图)
- CCF 201512-4 送货
- 【CCF 送货 waing】
- 201512-4 送货 ccf
- ccf 201512-4送货
- CCF之送货(java)
- ccf认证送货20分
- CCF-201512-4 送货(欧拉路径)
- 【软考学习】——线性表
- XML文档数据库--schema约束简单演示
- HDU 5877 Weak Pair(离散化+dfs+树状数组)——2016 ACM/ICPC Asia Regional Dalian Online
- 为什么要开始学习Android
- 分布式事务解决方案
- ccf 送货
- 系统重装An operating system wasn't found.Try .....问题解决方案
- android中ListView的嵌套冲突问题
- 在LoadRunner自动录制脚本时,默认会发生REASON: Unable to connect to remote server: rc = -1 , le = 0,错误
- 安卓-系统功能跳转
- Eclipse导入项目的步骤以及常见问题
- angularjs中ng-route和ui-router简单用法的代码比较
- 熊猫烧香之病毒查杀总结
- Luogu P1823 音乐会的等待 解题报告