提交时间:2022-07-19 12:05:45
运行 ID: 52392
#include <iostream> #include <fstream> #include <vector> #include <cstring> using namespace std; const int MAXN=5e5+5; struct Line{ int l,r; }; int n,floor_size,ans,maxn_ans; //vector<int> floor; int floor[2005]; Line line[MAXN]; int main(){ freopen("game.in","r",stdin); cin >> n; for ( int i=0; i<n; i++ ){ cin >> line[i].l >> line[i].r; floor_size=max(line[i].r,floor_size); } for ( int i=0; i<n-1; i++ ){ // for ( int o=1; o<=floor_size; o++ ){ // ans=max(floor[o],ans); // } memset(floor,0,sizeof(floor)); maxn_ans=max(ans,maxn_ans); for ( int m=1; m<=floor_size; m++ ){ floor[m]=0; } for ( int j=line[i].l; j<=line[i].r; j++ ){ floor[j]++; } for ( int k=i+1; k<=n; k++ ){ if ( line[k].l<=line[i].l&&line[i].r<=line[k].r ){ for ( int l=line[k].l; l<=line[k].r; l++ ){ floor[l]++; } } } } freopen("game.out","w",stdout); cout << maxn_ans; return 0; }