题意:在区间[0, 10^9]上染黑白两种颜色,问最后最长的白段的起点和终点。(初始区间全白)
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1019
——>>看数据可知要离散化。。而题意可知可用线段树去解决。。
对于区间[x, y],因为点到点,不是段到段,所以,可让x表示[x, x+1],整个区间的最后一点不表示,转化成段到段来解决。。于是[x, y]转化为[x, y-1]。。
时间复杂度为O(n)
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define lc (o<<......
阅读全文