Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- 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] += 1;
- mapa[b + 1] -= 1;
- }
- int res = 0, sum = 0;
- for(auto i : mapa) {
- sum += i.second;
- res = max(res, sum);
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement