会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
Qiuqiqiu
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!
公告
日历
导航
博客园
首页
新随笔
新文章
联系
订阅
管理
2012年6月27日
hdu 2818 Building Block
摘要: 并查集up记录x上面的个数,sum记录总数View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=30010; 6 int set[N],up[N],sum[N]; 7 int find(int x) 8 { 9 if(x==set[x]) return x;10 int t=find(set[x]);11 up[x]+=up[set[x]];12 return set[x]=t;13 }14 int main()15 {16 ...
阅读全文
posted @ 2012-06-27 11:14 Qiuqiqiu
阅读(196)
评论(1)
推荐(0)
编辑
Copyright © 2024 Qiuqiqiu
Powered by .NET 8.0 on Kubernetes