比赛时没做出来orz
剩下一段时间去hack了
不过当时估计也做不出了
好难啊
#include<bits/stdc++.h>
#define ll long long
#define N 200015
#define M 1<<10
#define lowbit(i) ((i)&(-i))
using namespace std;
int n,m,k,maxn,p[N],l[N],r[N];
int sm[M],st[M],vis[M],f[2][M],val[M];
vector<int> mem[N];
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
scanf("%d%d%d",&n,&m,&k);
for(int i = 1;i <= n;++i) {
scanf("%d%d",&l[i],&r[i]);
p[++maxn] = l[i];
p[++maxn] = r[i]+1;
}
sort(p+1,p+maxn+1);
maxn = unique(p+1,p+maxn+1)-p-1;
for(int i = 1;i <= n;++i){
int le = lower_bound(p+1,p+maxn+1,l[i])-p,
ri = lower_bound(p+1,p+maxn+1,r[i]+1)-p;
for(int j = le;j < ri;++j)
mem[j].push_back(i);
}
int now = 0,next = 1;
for(int i = 1;i < maxn;++i){
int s0 = mem[i