摘要:
并查集 简单题 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... 阅读全文
2014年7月23日
摘要:
并查集 简单题 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... 阅读全文
摘要:
并查集 入门题 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... 阅读全文
摘要:
暴力搜索 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... 阅读全文
2014年7月19日
摘要:
超级密码Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密... 阅读全文
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 ... 阅读全文
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[... 阅读全文
摘要:
集训第一场,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]={{-... 阅读全文
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[... 阅读全文