其实不离散化也可以过
只是要该数据类型。
其实你分析一下就知道啊。
复杂度和端点坐标的范围又没有关系。
我们二分的是序数。
哎,反正离散化都打了。
就当练手咯
#include<bits/stdc++.h>
using namespace std;
#define Rep(i,a,b) for(int i=(a);i<=(b);i++)
template<class T>
inline void get(T& x)
{
char c=getchar();
for(x=0;!isdigit(c);c=getchar());
for(;isdigit(c);x=x*10L+c-'0',c=getchar());
}
int n;
typedef long long LL;
#define maxn 1000010
struct Seg{
LL l,r;
int w;
}e[maxn];
LL dp[maxn];
LL table[maxn<<1];
int idx;
bool cmp(Seg x,Seg y)
{
return x.r==y.r?x.l<y.l:x.r<y.r;
}
int main()
{
get(n);
Rep(i,1,n)
{
get(e[i].l),get(e[i].r),get(e[i].w);
table[++idx]