zoj1610(线段树-染色区间连续段数…
来源:互联网 发布:java class 命名规范 编辑:程序博客网 时间:2024/06/06 11:03
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=610
Your task is counting the segments of different colors you cansee at last.
Input
The first line of each data set contains exactly one integer n, 1<= n <= 8000, equal to the number ofcolored segments.
Each of the following n lines consists of exactly 3 nonnegativeintegers separated by single spaces:
x1 x2 c
x1 and x2 indicate the left endpoint and right endpoint of thesegment, c indicates the color of the segment.
All the numbers are in the range [0, 8000], and they are allintegers.
Input may contain several data set, process to the end offile.
Output
Each line of the output should contain a color index that can beseen from the top, following the count of the segments of thiscolor, they should be printed according to the color index.
If some color can't be seen, you shouldn't print it.
Print a blank line after every dataset.
Sample Input
5
0 4 4
0 3 1
3 4 2
0 2 2
0 2 3
4
0 1 1
3 4 1
1 3 2
1 3 1
6
0 1 0
1 2 1
2 3 1
1 2 0
2 3 0
1 2 1
Sample Output
1 1
2 1
3 1
1 1
0 2
1 1
Source: ZOJ Monthly, May 2003
#include
#include
#include
using namespace std;
#define maxn 8010
#define L(x) (x*2)
#define R(x) (x*2+1)
struct node
{
}node [maxn*3];
int cnt[maxn],pre;
void build(int t,int l,int r)
{
}
void Update(int t,int l,int r,int col)//多种覆盖颜色为-2
{
}
void Compute(int i) //计算线段树
{
}
int main()
{