some dp problems

This commit is contained in:
2024-06-14 19:49:10 +02:00
parent 66d059f230
commit b67bf7bbea
21 changed files with 124 additions and 1 deletions

View 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;
}