another 4 sorting and searching problems
This commit is contained in:
25
CSES - CSES Problem Set/Restaurant_Customers.cpp
Normal file
25
CSES - CSES Problem Set/Restaurant_Customers.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user