2014年7月23日

摘要: 并查集 简单题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] >= 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(i... 阅读全文
posted @ 2014-07-23 01:06 lpt 阅读(144) 评论(0) 推荐(0) 编辑
 
摘要: 并查集 简单题 1 #include 2 #include 3 #include 4 #define N 10000005 5 using namespace std; 6 int par[N]; 7 int M[N]; 8 int Find(int x) 9 {10 if(par[x... 阅读全文
posted @ 2014-07-23 01:04 lpt 阅读(113) 评论(0) 推荐(0) 编辑
 
摘要: 并查集 入门题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] > 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(in... 阅读全文
posted @ 2014-07-23 01:03 lpt 阅读(127) 评论(0) 推荐(0) 编辑
 
摘要: 暴力搜索 1 #include 2 3 struct node 4 { 5 int x; 6 int y; 7 }s[10000]; 8 int main() 9 {10 //freopen("input.txt","r",stdin);11 int a,b,n,n... 阅读全文
posted @ 2014-07-23 01:01 lpt 阅读(380) 评论(0) 推荐(0) 编辑

2014年7月19日

摘要: 超级密码Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密... 阅读全文
posted @ 2014-07-19 00:50 lpt 阅读(302) 评论(0) 推荐(0) 编辑

2014年7月18日

摘要: 可以转化为着色模型dfs + 四色定理 1 #include 2 #include 3 int n,num; 4 int d[100][100]; 5 int c[100]; 6 7 bool ok(int step) 8 { 9 for(int i = 0; i = n) return ... 阅读全文
posted @ 2014-07-18 00:22 lpt 阅读(168) 评论(0) 推荐(0) 编辑

2014年7月16日

摘要: 集训第一场 B题dfs简单题 做完这题就撤,回来再继续做吧= = 水手加油~ 1 #include 2 #include 3 4 int Count; 5 int to[4][2] = {{-1,0},{1,0},{0,1},{0,-1}}; 6 int row,col; 7 char room[... 阅读全文
posted @ 2014-07-16 20:02 lpt 阅读(115) 评论(0) 推荐(0) 编辑
 
摘要: 集训第一场,A题dfs简单题之前看过dfs,没实现过,第一次实现出来O(∩_∩)O~水手加油~ 1 #include 2 #include 3 using namespace std; 4 int row,col; 5 char oil[1000][1000]; 6 int to[8][2]={{-... 阅读全文
posted @ 2014-07-16 20:00 lpt 阅读(97) 评论(0) 推荐(0) 编辑
 
摘要: Trie树,第一次写,简单的建树+搜索它的思路hiho上讲得很清楚,good~ 1 #include 2 #include 3 using namespace std; 4 char word[11]; 5 int n,m; 6 struct trie 7 { 8 int num; 9 ... 阅读全文
posted @ 2014-07-16 19:54 lpt 阅读(140) 评论(0) 推荐(0) 编辑

2014年6月3日

摘要: 简单的排序,注意输出即可#include #include using namespace std;int main(){ int a[10001]; int n,i; //int t = 0; while(cin>>n) { //if(t)cout>a[... 阅读全文
posted @ 2014-06-03 23:39 lpt 阅读(128) 评论(0) 推荐(0) 编辑