#include #include #include #include #include using namespace std; const int maxn=60000; int n,use[maxn]; struct Node { int l; int r; int pos; bool operator <(const Node &a)const { if(r==a.r) return l>a.l; return r>a.r; } }a[maxn]; priority_queue q; bool cmp(Node a,Node b) { if(a.l==b.l) return a.r