一开始就瞄准了这一题,题目没看懂,想看其他题目,没想到瞬间就有十几个人A了,果断继续看,发现只要距离远的先输送细菌就好了View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct cell{ int d,t;}c[100010];int end[100010];int sum;int cmp(cell a,cell b){ if(a.t==b.t) return a.d>b.d; return a.t>b.t;}int mai Read More
posted @ 2011-10-07 20:30 Because Of You Views(298) Comments(0) Diggs(0) Edit
题目数据较小,直接枚举自己和敌人的所有全排列,暴力水之(讨论出做法后,队友写的)View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int n;int id1[10],id2[10];struct node{ char s[25];}p[10];int map[10][10];int cmp(node a,node b){ return strcmp(a.s,b.s)<0;}void init(){ for(int i=0;i<n; Read More
posted @ 2011-10-07 20:23 Because Of You Views(250) Comments(0) Diggs(0) Edit
View Code #include<stdio.h>#include<string.h>int n,m;int p[1101000];int id[1101000];int vis[1100010];void init(){int i;memset(vis,0,sizeof(vis));for(i=0;i<=n;i++){p[i]=i;id[i]=i;}}int find(int x){return x==p[x]?x:p[x]=find(p[x]);}void unio(int x,int y){ int tx=find(x);int ty=find(y);i Read More
posted @ 2011-10-07 20:15 Because Of You Views(437) Comments(0) Diggs(0) Edit
http://blog.csdn.net/fp_hzq/article/category/890938 Read More
posted @ 2011-10-07 19:53 Because Of You Views(173) Comments(0) Diggs(0) Edit
用位运算来实现广搜,每一条边就是一个方向View Code #include<stdio.h>#include<queue>#include<string.h>using namespace std;int steps;queue<int> Q;int vis[1<<17];int dir[32][2]={0,1,0,2,0,8,0,4, 1,3,1,9,1,5, 3,7,3,2,3,11, 11,9,11,15,11,10, 10,2,10,8,10,14, 8,12,8,9, 9,13, 2,6, 4,5,4,6,4,12, 5, Read More
posted @ 2011-10-07 18:40 Because Of You Views(256) Comments(0) Diggs(0) Edit