2013年3月28日

摘要: 题意:给出n(n<=1000)个长方体,求重合三次及以上的体积和。思路:枚举+扫描线+离散化。枚举z,求相应的覆盖三次及以上以上的面积和。View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 2005 7 struct op 8 { 9 int l,r,y,cnt; 10 }mes[maxn]; 11 str 阅读全文
posted @ 2013-03-28 09:10 kim888168 阅读(177) 评论(0) 推荐(0) 编辑

2013年3月6日

摘要: 优先队列+bfsAC Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 int vis[25][25]; 6 int map[25][25],tmp[25][25]; 7 int k; 8 int x1,y1,x2,y2,r,c; 9 struct 10 { 11 int x,y,val; 12 }a[505]; 13 void down() 14 { 15 int x=a[k].x,y=a[k].y,val=a[k].. 阅读全文
posted @ 2013-03-06 23:22 kim888168 阅读(115) 评论(0) 推荐(0) 编辑

2013年3月3日

摘要: http://poj.org/problem?id=2760My Code 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 #define lson l,m,rt<<1 6 #define rson m+1,r,rt<<1|1 7 #define maxn 1005 8 #define eps 1e-6 9 struct node 10 { 11 double len; 12 int c; 13 }setree 阅读全文
posted @ 2013-03-03 23:54 kim888168 阅读(217) 评论(0) 推荐(0) 编辑

2013年2月25日

摘要: http://www.spoj.com/problems/GSS5/My Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 10005 7 struct node 8 { 9 int lmax,rmax,max,sum; 10 }setree[maxn<<2]; 11 int sum[maxn]={ 12 0 阅读全文
posted @ 2013-02-25 19:30 kim888168 阅读(150) 评论(0) 推荐(0) 编辑

2013年2月21日

摘要: http://www.spoj.com/problems/GSS4/My Code 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 #define lson l,m,rt<<1 6 #define rson m+1,r,rt<<1|1 7 #define maxn 100010 8 typedef long long LL; 9 struct node10 {11 int c;12 LL sum;13 }set 阅读全文
posted @ 2013-02-21 23:25 kim888168 阅读(276) 评论(0) 推荐(0) 编辑

2013年2月19日

摘要: http://www.spoj.com/problems/GSS3/My Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 50001 7 struct node 8 { 9 int lmax,rmax,max,sum;10 }setree[maxn<<2];11 int ans;12 void pushup 阅读全文
posted @ 2013-02-19 22:35 kim888168 阅读(186) 评论(0) 推荐(0) 编辑
 
摘要: http://www.spoj.com/problems/GSS1/My Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 50010 7 struct node 8 { 9 int lmax,rmax,max,sum;10 }setree[maxn<<2];11 int ans;12 void pushup 阅读全文
posted @ 2013-02-19 20:43 kim888168 阅读(163) 评论(0) 推荐(0) 编辑

2013年2月15日

摘要: http://poj.org/problem?id=1195简单二维线段树题。单点更新区间求和。My Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 1024 7 int n; 8 struct node 9 {10 int setree1[maxn<<1];11 }setree[maxn<<1 阅读全文
posted @ 2013-02-15 20:40 kim888168 阅读(99) 评论(0) 推荐(0) 编辑
 
摘要: Incredible Crazily Progressing Company (ICPC) suffered a lot with the low speed of procedure. After investigation, they found that the bottleneck was at Absolutely Crowded Manufactory (ACM). In oder to accelerate the procedure, they bought a new machine for ACM. But a new problem comes, how to place 阅读全文
posted @ 2013-02-15 16:54 kim888168 阅读(196) 评论(0) 推荐(0) 编辑

2013年2月12日

摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4801离线做,将查询区间从小到大排序,具体处理见代码My Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define maxn 50002 6 struct op 7 { 8 int l,r,id; 9 }mes[maxn];10 int num[maxn*10],pos[maxn*10];11 i 阅读全文
posted @ 2013-02-12 15:48 kim888168 阅读(136) 评论(0) 推荐(0) 编辑