题目描述:
在一面墙上,铺海报,相互覆盖,求能看到几种不同的;
相当于在一个区间里染色,求最后能看到几种颜色;
这道题的重点在于离散压缩+线段树;
#include<cstdio>
#include<cstdlib>
#include<cstring>
struct pp{int v,w,num;
};
pp t[20100];//记录每一个poster的l,r,i,以便离散;
int f[80001],l[10001],r[10001];
bool twice[20001];
//f数组记录线段树,twice记录颜色是否被计算过;
void swap(pp &x,pp &y){pp t=x;x=y;y=t;
}
void sort(int x,int y)//排序;
{int i=x,j=y,k=t[(x......
阅读全文