记录详情

Wrong Answer

/in/foo.cc: In function 'void dij()':
/in/foo.cc:47:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(vis1[x])continue;vis1[x]=1;
   ^~
/in/foo.cc:47:23: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
   if(vis1[x])continue;vis1[x]=1;
                       ^~~~
/in/foo.cc: In function 'void dfs2(int)':
/in/foo.cc:73:7: warning: unused variable 'y' [-Wunused-variable]
   int y=ed[i].to;
       ^
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 216.0 KiB
#2 Wrong Answer 1ms 224.0 KiB
#3 Wrong Answer 1ms 228.0 KiB
#4 Wrong Answer 1ms 224.0 KiB
#5 Wrong Answer 1ms 228.0 KiB
#6 Wrong Answer 1ms 224.0 KiB
#7 Wrong Answer 1ms 228.0 KiB
#8 Wrong Answer 1ms 224.0 KiB
#9 Wrong Answer 1ms 228.0 KiB
#10 Wrong Answer 1ms 224.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn=100010;
int t,n,m,k,p,head[maxn],tail[maxn],e=0,r1,r2,r3,d[maxn],df,fa[maxn];
long long f[maxn];
bool vis1[maxn],vis2[maxn],bbb;
struct edge
{
	int from,to,val,next1,next2;
	long long f;
}ed[maxn<<1];
struct node
{
	int w,num;
	inline bool operator <(const node &x)const
	{
		return w<x.w;
	}
};
priority_queue<node> q;

inline void addedge(int x,int y,int z)
{
	ed[++e].from=x;
	ed[e].to=y;
	ed[e].val=z;
	ed[e].next1=head[x];
	ed[e].next2=tail[y];
	ed[e].f=0;
	head[x]=e;
	tail[y]=e;
}
int find(int x)
{
	if(fa[x]==x)return x;
	return fa[x]=find(fa[x]);
}

inline void dij()
{
	memset(d,0x3f3f3f3f,sizeof(d));
	q.push((node){0,1});
	d[1]=0;
	while(!q.empty())
	{
		node k=q.top();q.pop();int x=k.num;
		if(vis1[x])continue;vis1[x]=1;
		for(int i=head[x];i;i=ed[i].next1)
		{
			int y=ed[i].to;
			if(d[y]>d[x]+ed[i].val)
			{
				d[y]=d[x]+ed[i].val;
				q.push((node){d[y],y});
			}
		}
	}
}
void dfs1(int x)
{
	for(int i=tail[x];i;i=ed[i].next2)
	{
		int y=ed[i].from;
		if(vis2[y])continue;
		vis2[y]=1;
		dfs1(y);
	}
}
void dfs2(int x)
{
	for(int i=head[x];i;i=ed[i].next1)
	{
		int y=ed[i].to;
		
	}
}


inline void init()
{
	memset(vis1,false,sizeof(vis1));
	memset(vis2,false,sizeof(vis2));
	memset(head,0,sizeof(head));
	memset(tail,0,sizeof(tail));
	for(int i=1;i<=e;i++)
	{
		ed[i].from=0;
		ed[i].f=0;
		ed[i].to=0;
		ed[i].next1=0;
		ed[i].next2=0;
		ed[i].val=0;
	}
	e=0;
	memset(f,0,sizeof(f));
	scanf("%d%d%d%d",&n,&m,&k,&p);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d%d",&r1,&r2,&r3);
		addedge(r1,r2,r3);
	}
	for(int i=1;i<=n;i++)
		fa[i]=i;
	bbb=0;
}
int main()
{
printf("3\n-1");
return 0;
}

信息

递交者
类型
递交
题目
P1011 逛公园
比赛
随机真题赛第四轮(xhy&lfy讲题)
题目数据
下载
语言
C++
递交时间
2019-11-13 16:05:06
评测时间
2019-11-13 16:05:06
评测机
分数
0
总耗时
13ms
峰值内存
228.0 KiB