最小不相交分组数等于最大相交组的元素个数
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 5;
int a[N << 1];
int n;
int main(){
cin >> n;
for(int i = 0; i < n; i++){
int l, r;
cin >> l >> r;
a[i << 1] = l << 1;
a[i << 1 | 1] = r << 1 | 1;
}
n = n << 1;
sort(a, a + n);
int res = 0, t = 0;
for(int i = 0; i < n; i++){
if(a[i] & 1)t--;
else t++;
res = max(res, t);
}
cout << res << endl;
return 0;
}