/* >>~~ UVa Online Judge ACM Problem Solution ~~<< ID: 10020 Name: Minimal coverage Problem: https://onlinejudge.org/external/100/10020.pdf Language: C++ Author: Arash Shakery Email: arash.shakery@gmail.com */ #include #include #include using namespace std; struct line{ int s,e; bool operator<(const line &t)const{ if(s!=t.s)return st.e; } }; line a[100001]; bool ch[100001]; int main(){ int T,i,j,k,m,n,cnt,cur; cin>>T; while(T--){ cin>>m; n=0; while(scanf("%d%d",&a[n].s,&a[n].e)==2 && (a[n].s||a[n].e)) ch[n++]=0; sort(a,a+n); cur=cnt=0; for(i=0;ia[k].e) k=j; ch[k]=1; cnt++; cur=a[k].e; i=k; } if(cur>=m){ cout<