/ Randle /

记录详情

Compile Error

/in/foo.cc: In member function 'const int LINK_CUT_TREE::dfs1(int)':
/in/foo.cc:86:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^
/in/foo.cc: In member function 'const int LINK_CUT_TREE::dfs2(int)':
/in/foo.cc:90:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^
/in/foo.cc: In member function 'const void SEGMENT_TREE::update(int)':
/in/foo.cc:104:2: error: expected primary-expression before '}' token
  }
  ^

代码

#include<bits/stdc++.h>
const int maxn=55000;
inline const void read(int &a)
{
	char c=getchar();int b=1;a=0;
	while(c<'0'||c>'9'){if(c=='-')b=-1;c=getchar();}
	while(c>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
	a*=b;
}
inline const void write(int a)
{
	if(a<0){putchar('-');a=-a;}
	if(a>9)write(a/10);
	putchar(a%10+'0');
}
inline const int min(int a,int b)
{
	if(a<b)return a;
	return b;
}
inline const int max(int a,int b)
{
	if(a>b)return a;
	return b;
}
int n,m,t,d=0;
int from[maxn],to[maxn],next[maxn],point[maxn],height[maxn];
inline const void add(int a,int b,int h)
{
	next[++d]=point[a];
	to[d]=b;
	point[a]=d;
	height[d]=h;
}
struct LEAST_TREE
{
	int belong[maxn];
	inline const int check(int a)
	{
		if(a==belong[a])return a;
		return belong[a]=check(belong[a]);
	}
	struct side
	{
		int from,to,next,height;
		inline const bool operator<(const side&b)
		{
			if(height<b.height)return true;
			return false;
		}
	}s[maxn];
	void solve()
	{
		for(int i=1;i<=n;i++)belong[i]=i;
		memset(point,false,sizeof(point));
		for(int i=1;i<=m;i++){read(s[i].from);read(s[i].to);read(s[i].height);}
		std::sort(s+1,s+1+m);
		int k=n-1,t=1;
		while(k)
		{
			if(check(s[t].from)==check(s[t].to)){t++;continue;}
			belong[check(s[t].from)]=s[t].to;
			add(s[t].from,s[t].to,s[t].height);
			k--;t++;
		}
	}
}least_tree;
int leaf[maxn],father[maxn],top[maxn],left[maxn],right[maxn];
struct LINK_CUT_TREE
{
	int son[maxn];
	bool vis[maxn];
	inline const int dfs1(int p)
	{
		vis[p]=true;
		int side=point[p];
		while(side)
		{
			if(!vis[to[side]])
			side=next[side];
		}
	}
	inline const int dfs2(int p)
	{
		
	}
	void solve()
	{
		memset(vis,false,sizeof(vis));
		dfs1(1);
		dfs2(1);
	}
}link_cut_tree;
struct SEGMENT_TREE
{
	int big[maxn],r=0;
	inline const void update(int p)
	{
		big[p]=//max(big[p<<1],small[p<<1|1]);
	}
	inline const void build(int p,int l,int r)
	{
		if(l==r)big[p]=leaf[++r];
	}
	inline const void query(int p,int l,int r,int ll,int rr)
	{
		
	}
	void solve()
	{
		while(m)
		{
			m--;
			int start,end;
			read(start);read(end);
			
		}
	}
}segment_tree;
int main()
{
	read(n);read(m);read(t);
	least_tree.solve();
	link_cut_tree.solve();
	segment_tree.solve();
	return 0;
}

信息

递交者
类型
递交
题目
江边沼泽淹死村民(第一个ac奖励30元)
题目数据
下载
语言
C++
递交时间
2017-10-12 21:10:21
评测时间
2017-10-12 21:10:59
评测机
分数
0
总耗时
1361ms
峰值内存
133.879 MiB