/**
[统计] poj 2761 Feed the dogs
题意: n个数,m个查询,每次查询[l,r]区间里第k小的数。(需要离散化)
题目保证了区间不会相互包含,可以按L排个序。
然后对于每个区间加入新节点,删去旧结点,就成了裸的查第k小。
这里用 树状数组+二分 实现,O(NlogNlogN)
*/
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define N 100001
#define lowbit(i) (i&-i)
struct lisan
{
int val,id;
lisan(int a = 0,int c = 0)
{
val = a;
id = c;
}
}lisa[N];
struct node
{
int x[2],k,id;
void input(int i)
{
id = i;
scanf("%d%d%d",x,x+1,&k);
}
}qua[N];
int val[N],cnt[N];
int n,m;
int ans[N];
bool cmp(node a,node b)
{
return a.x[0] < b.x[0];
}
bool cmp2(lisan a,lisan b)
{
return a.val < b.val;