#include #define N 20005 #define M 200005 using namespace std; int n,m; bool mark[N]; struct node{ int t,p,id; }Q[M]; inline void Rd(int &res){ char c;res=0; while(c=getchar(),c<48); do res=(res<<3)+(res<<1)+(c^48); while(c=getchar(),c>47); return; } inline bool cmp(node a,node b){ return a.t==b.t?a.p