http://acm.hdu.edu.cn/showproblem.php?pid=4419
一直想怎么直接处理多个颜色信息,sb了,直接暴力算每种颜色的面积并,再通过容斥原理乱搞计算得到每块的面积即可。
直接开7个大小为N的线段树维护每个颜色会超时,要按每种颜色数量开一个,刚好400ms
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
const int N =2* 10000+500 ;
struct node
{
int flag;
int lx,rx,y,col;
node() {}
node(double a,double b,double c,int d,int cc)
{
lx=a,rx=b,y=c,flag=d;
col=cc;
}
bool operator<(node b)const
{
return y<b.y;
}
};
node line[N],line22[N];
int X[2*N];
struct tree
{
long long sum[4*N];
long long add[4*N];
void build(int l,int r,int rt)