Advertisement
Josif_tepe

Untitled

Jun 2nd, 2024
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   map<int, int> mapa;
  8.   int n;
  9.   cin >> n;
  10.  
  11.   int x[n][2];
  12.   for(int i = 0; i < n; i++) {
  13.     cin >> x[i][0] >> x[i][1];
  14.  
  15.     mapa[x[i][0]]++;
  16.     mapa[x[i][1] + 1]--;
  17.   }
  18.     int maksimum = 0, ans = 0;
  19.   for(auto it = mapa.begin(); it != mapa.end(); it++) {
  20.     ans += it->second;
  21.     maksimum = max(maksimum, ans);
  22.   }
  23.   cout << maksimum << endl;
  24.  
  25.  
  26.  
  27.  
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement