Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n;
- cin>>n;
- vector<pair<int,int>>events;
- for(int i=0;i<n;i++){
- int start,end;
- cin>>start>>end;
- events.push_back({start, 1 });
- events.push_back({end,-1 });
- }
- sort(events.begin(),events.end());
- int vist=0;
- int maks=0;
- for(int i=0;i<events.size();i++){
- vist+=events[i].second;
- maks=max(maks,vist);
- }
- cout<<maks<<endl;
- cout<<events.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement