12 2012 档案

摘要:大部分是风神博客上的题目,我在此基础上增删了些题目。【HDU】1213 How Many Tables 基础并查集★1272 小希的迷宫 基础并查集★1325&&poj1308 Is It A Tree? 基础并查集★1856 More is better 基础并查集★1232 畅通工程 基础并查集★1811 Rank of Tetris 并查集+拓扑排序★★3926 Hand in Hand 同构图★3938 Portal 离线+并查集★★2860 并查集★1558 Segment set 计算几何+并查集★2144 LCS(连续)+并查集(重点是处理LCS)★★1829&a 阅读全文
posted @ 2012-12-22 14:24 kiwi_bird 阅读(260) 评论(0) 推荐(0)
摘要:样例是这样的:Sample Inputblue redred violetcyan blueblue magentamagenta cyanSample OutputPossible把棍子看做无向边,把端点看做点,且颜色相同的端点视作同一点。画成图后,是这个样子:题目的问题是,是否能把这些棍子排成一条直线,且连接处颜色相同。如图,(v,e1,r,e2,b,e3,c,e4,m,e5,b)即为一种可行解。这样点边交替的序列,包含了图中的每一条边,且每条边只走过一次。这样的序列就是一条欧拉迹。(欧拉迹包括欧拉环游和欧拉通路,欧拉环游的起点和终点相同,而欧拉通路则不同。含有欧拉环游的图称为欧拉图。含有 阅读全文
posted @ 2012-12-21 21:47 kiwi_bird 阅读(384) 评论(0) 推荐(0)
摘要:1 #include<cstdio> 2 #include<cstring> 3 const int maxnode = 100005; 4 5 char data[10005][15]; 6 struct Trie 7 { 8 int tree[maxnode][10],sz; 9 int amount[maxnode];10 void init(void)11 {12 sz=0;13 memset(tree[0],0,sizeof(tree[0]));14 memset(amount,0,sizeof(am... 阅读全文
posted @ 2012-12-15 20:06 kiwi_bird 阅读(179) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 6 int tree[205]; 7 struct edge 8 { 9 int s,e,w;10 }data[1005];11 12 bool cmp(const edge&a,const edge&b)13 {14 return a.w<b.w;15 }16 17 int find(int x)18 {19 if( -1==tree[x] ) return x 阅读全文
posted @ 2012-12-12 09:06 kiwi_bird 阅读(190) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<queue> 5 using namespace std; 6 7 const int MAXN = 10005; 8 9 int tree[MAXN],indegree[MAXN],n,m; 10 int first[MAXN],sn[2*MAXN],en[2*MAXN],next[2*MAXN]; 11 struct edge 12 { 13 int s,e,type; 14 }data[2*MA 阅读全文
posted @ 2012-12-08 16:33 kiwi_bird 阅读(196) 评论(0) 推荐(0)