andre_joy

导航

2012年7月13日

hdu 1166

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1166题意:中文……mark:线段树。第一次写线段树,目的是减小空间复杂度。代码:#include <stdio.h>#define LL(x) ((x) << 1)#define RR(x) ((x) << 1 | 1)typedef struct{ int le,ri,mi,su;}tree;int a[50010];tree t[150000];int build(int l, int r, int s){ t[s].le = l; t[s].ri = r; t 阅读全文

posted @ 2012-07-13 21:14 andre_joy 阅读(109) 评论(0) 推荐(0) 编辑

hdu 1856

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1856题意:找一组的最大人数。mark:并查集,注意最后搜索的细节。虽然wa了很多次,但是ac了还是很爽的。代码:#include <stdio.h>#include <string.h>#include <stdlib.h>int a[200010], b[200010], c[200010][2], d[100010];int j;int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b 阅读全文

posted @ 2012-07-13 17:39 andre_joy 阅读(122) 评论(0) 推荐(0) 编辑

hdu 1232

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1232题意:中文……mark:并查集。代码:#include <stdio.h>int s[1010];int find(int a){ if(s[a] == a) return a; return s[a] = find(s[a]);}void merge(int a, int b){ int p = find(a), q = find(b); if(p != q) s[p] = q;}int main(){ int n,m,a,b; int i,sum; w... 阅读全文

posted @ 2012-07-13 13:58 andre_joy 阅读(163) 评论(0) 推荐(0) 编辑

hdu 1253

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1253题意:中文……mark:bfs,wa了无数次啊,,细节处理的不好,没注意走不出去的情况。可能有两种,第一种根本无法走到门,第二种门本来就是死路。代码:#include <stdio.h>#include <string.h>int s[130000][3],d[50][50][50],h[50][50][50],a,b,c,t;void bfs(){ int front = 0, rear = 1; int aa,bb,cc,aaa,bbb,ccc,i; int tab[6 阅读全文

posted @ 2012-07-13 11:48 andre_joy 阅读(189) 评论(0) 推荐(0) 编辑