提交记录 8254
| 提交时间 |
评测时间 |
| 2019-02-06 09:11:39 |
2020-08-01 01:14:52 |
#include<cstdio>
#include<queue>
using namespace std;
int n,m,sum,cnt;
struct edge{
int f,t,nxt;
}e[1000010];
int head[500010],vis[500010],ans[500010];
inline int read(){
int x=0;char c=getchar();
while(c<'0'||c>'9') c=getchar();
while(c<='9'&&c>='0') x=x*10+(c^'0'),c=getchar();
return x;
}
inline void add(int u,int v){
e[++sum].f=u;
e[sum].t=v;
e[sum].nxt=head[u];
head[u]=sum;
}
int main()
{
n=read();m=read();
for(int i=1;i<=m;i++)
{
int u=read(),v=read();
add(u,v);
add(v,u);
}
priority_queue<int,vector<int>, greater<int> > q;
q.push(1);vis[1]=1;
while(!q.empty())
{
int u=q.top();q.pop();
printf("%d ",u);
for(int i=head[u];i;i=e[i].nxt)
{
int t=e[i].t;
if(!vis[t])
q.push(t),vis[t]=1;
}
}
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 14.26 us | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #2 | 16.19 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #3 | 33.39 us | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #4 | 31.7 us | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #5 | 920.03 us | 216 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #6 | 913.56 us | 216 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #7 | 23.307 ms | 3 MB + 668 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #8 | 23.176 ms | 3 MB + 668 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #9 | 168.559 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #10 | 168.047 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #11 | 168.235 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #12 | 167.57 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #13 | 1.004 ms | 216 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #14 | 968.63 us | 216 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #15 | 23.247 ms | 3 MB + 668 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #16 | 23.022 ms | 3 MB + 668 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #17 | 166.955 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #18 | 166.924 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #19 | 168.471 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #20 | 167.851 ms | 18 MB + 528 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-04-07 03:19:01 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠