2012年11月8日

摘要: 题目大意:一块高为h,宽为m的墙,在墙上涂上不同颜色的矩形,求经过一系列操作后每种颜色相应的面积和颜色种数。需要注意的是输出时要判断颜色种数,如果是1或0要用is,否则用are(这里害我wa了好几次)。-_-!思路:离散化。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 int a[205][205]; 6 struct 7 { 8 int x,y; 9 }bottomleft[105],topright[10 阅读全文
posted @ 2012-11-08 23:05 kim888168 阅读(157) 评论(0) 推荐(0) 编辑
 
摘要: 题目大意:一个农园有n个花朵,给出每朵花的开花时间(用区间表示),求在特定时间点的开花的花朵数量。思路:离散化,线段树。在建树时有些点表示单个时间点,有些要表示时间区间。然后单点查询即可。View Code 1 #include <cstdio> 2 #include <cstring> 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 s 阅读全文
posted @ 2012-11-08 09:29 kim888168 阅读(139) 评论(0) 推荐(0) 编辑