Advertisement
Josif_tepe

Untitled

Mar 18th, 2022
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <set>
  7. #include <cstring>
  8. #include <map>
  9. using namespace std;
  10. typedef long long ll;
  11.  
  12. int main(){
  13.     ios_base::sync_with_stdio(false);
  14.     int n;
  15.     cin >> n;
  16.     int a, b;
  17.     map<int, int> mapa;
  18.     for(int i = 0; i < n; i++) {
  19.         cin >> a >> b;
  20.         mapa[a]++;
  21.         mapa[b + 1]--;
  22.        
  23.     }
  24.     int ans = 0;
  25.     int sum = 0;
  26.     for(auto x : mapa) {
  27.         sum += x.second;
  28.         ans = max(ans, sum);
  29.     }
  30.     cout << ans << endl;
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement