Advertisement
ivangarvanliev

Untitled

Jun 3rd, 2024
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main() {
  9.   int n;
  10.   cin>>n;
  11.   vector<pair<int,int>>events;
  12.   for(int i=0;i<n;i++){
  13.       int start,end;
  14.       cin>>start>>end;
  15.       events.push_back({start, 1 });
  16.       events.push_back({end,-1 });
  17.   }
  18.   sort(events.begin(),events.end());
  19.   int vist=0;
  20.   int maks=0;
  21.   for(int i=0;i<events.size();i++){
  22.       vist+=events[i].second;
  23.       maks=max(maks,vist);
  24.   }
  25.   cout<<maks<<endl;
  26.   cout<<events.size();
  27.  
  28.    
  29.    
  30.    
  31.    
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement