摘要: 题意: 有一个有N 个区间木板,存在最多 30 种颜色,一开始木板的颜色都为第一种颜色。 定义两种操作: Cxyc 将区间[x,y]涂成 c 颜色。 P xy询问区间[x,y]共有多少种颜色。分析: 比较典型的成段更新的线段树染色问题,使用延迟标记数组。#include<stdio.h>#include<string.h>#define clr(x)memset(x,0,sizeof(x))#define maxn 100005int col[maxn<<3];int v[33];void creat(int l,int r,int rt){ col[rt] 阅读全文
posted @ 2012-08-08 20:10 'wind 阅读(313) 评论(0) 推荐(0)
摘要: 题目:View Code Fleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I saw you smile, as you were walking out of the classroom and turned your head back, with the soft sunset 阅读全文
posted @ 2012-08-08 19:23 'wind 阅读(327) 评论(0) 推荐(0)
摘要: 题意: 有 n 个矩形,求总的覆盖面积。分析: 离散化浮点数坐标,以 x 轴 建树, 将每个矩形拆分成上下两条线段,从下向上扫描。/*************************************** 离散化浮点数,把矩形分成上边和下边, ** 按 x 坐标建树,从下向上扫描 ****************************************/#include<stdio.h>#include<string.h>#include<stdlib.h>#include<algorithm>#define clr(x)memse 阅读全文
posted @ 2012-08-08 13:02 'wind 阅读(228) 评论(0) 推荐(0)