Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can s…
W同学的新画板 QDUOJ 线段树 区间颜色段数 原题链接 题意 W同学在每天的刻苦学习完成功课之余,都会去找一些有趣的事情来放松自己:恰巧今天他收到了朋友送给他的一套画板,于是他立刻拆开了包装,拿出其中的画板和一些画笔,开心地画了起来:这时W同学注意到了闲暇的你正好待在一旁,于是他灵机一动,打算考验一下你的眼力,具体过程是这样的: W同学收到的画板可看作一个长条状的木板,画板从左端到右端可划分为等长的连续的n段(自左至右依次编号为第1段,第2段,第3段,...,第n段,如下图所示),开始时每一…
题意 : 给出 n 个染色操作,问你到最后区间上能看见的各个颜色所拥有的区间块有多少个 分析 : 使用线段树成段更新然后再暴力查询总区间的颜色信息即可,这里需要注意的是给区间染色,而不是给点染色,所以对于区间(L, R)我们只要让左端点+1即可按照正常的线段树操作来做. #include<bits/stdc++.h> #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 using namespace std; +…
题目链接:http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1610 题意:给一个长8000的绳子,向上染色.一共有n段被染色,问染色后共有多少不同的色段.注意假如相邻两个线段同色,那么算作一条线段. 线段树区间更新,不需要pushUP操作,因为查询和非叶节点无关.找长线段的时候首先定位最靠左那根,然后判后面是否与前面的线段颜色相等.注意有可能出现两条线段中间没有染色的情况,这时候查询返回一个无关值,这时候重置p即可. #inc…
Count the Colors Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 Description Painting some colored segments on a line, some previously painted segments may be covered by some the subseque…
Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can s…
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 Description Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different…
题目链接:https://vjudge.net/problem/ZOJ-1610 Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last. Input The firs…
题目 参考博客地址 题意: n范围[1,8000] ,  li 和 ri 的范围[0,8000].  n个操作,每个操作是把 [li , ri]内的点修改成一个颜色c. n个操作过后,按颜色从小到大 输出每种颜色分别有几块. #include<iostream> #include<cstdio> #include <cctype> #include<algorithm> #include<cstring> #include<cmath>…
[POJ 2777] Count Color(线段树区间更新与查询) Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40949   Accepted: 12366 Description Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here…