数据量很小,暴力莽过
#include<bits/stdc++.h> using namespace std; const int MAXN = 1000 + 10; int book[MAXN],a[MAXN] , b[MAXN]; int main() { int T, n; cin >> T; while(T --) { cin >> n; for(int i = 1; i <= n ;i ++) { cin >> a[i] >> b[i]; } int maxx = 0; for(int i = 1; i <= n ; i ++) { for(int j = 1; j <= 2; j ++) { int temp ; int t = 0; if(j == 1) temp = a[i]; else temp = b[i]; for(int u = 1;u <= n ; u++ ) { if(temp >= a[u] && temp <= b[u]) t ++; } maxx = max(maxx, t); //cout << temp << " " << maxx << endl; } } cout << maxx << endl; } return 0; }