Files
cses/CSES - CSES Problem Set/Restaurant_Customers.cpp

26 lines
445 B
C++

// Restaurant Customers
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n; cin >> n;
map<ll, int> m;
for (int i{}; i < n; i++) {
ll a, b;
cin >> a >> b;
m[a]++;
m[b]--;
}
int max_count = 0;
int count = 0;
for (auto &[t, c]: m) {
count += c;
max_count = max(max_count, count);
}
cout << max_count << endl;
return 0;
}