905. 区间选点 - AcWing题库
#include using namespace std; const int N=1e5+10; struct Range { int l,r; bool operator <(const Range&m)const { return r>n; for(int i=0;i>range[i].l>>range[i].r; } sort(range,range+n); int l=0,r=-0x3f3f3f3f; int res=0; for(int i=0;i=range[i].l) { continue; } else { r=range[i].r; res++; } } cout< 
906. 区间分组 - AcWing题库
#include using namespace std; const int N=1e5+10; struct Range{ int l,r; bool operator <(const Range &m)const { return l>n; for(int i=0;i>range[i].l>>range[i].r; } sort(range,range+n); priority_queue,greater>q; q.push(range[0].r); int res=1; for(int i=1;i
907. 区间覆盖 - AcWing题库
#include using namespace std; const int N=1e5+10; struct Range { int l,r; bool operator <(const Range&m)const { return l>be>>end; int n;cin>>n; for(int i=0;i>range[i].l>>range[i].r; } sort(range,range+n); int res=0; int check=0; for(int i=0;i=end) { check=1; break; } } if(check) cout<