Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
379 B
2
Indexable
Never
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  cin >> n;

  map<int, int> mapa;
  for(int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    mapa[a]++;
    mapa[b + 1]--;
  }
  int sum = 0, res = 0;
  for(auto it = mapa.begin(); it != mapa.end(); it++) {
    sum += it->second;
    res = max(res, sum);
  }

  cout << res << endl;


  return 0;
}
 
Leave a Comment