Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <map>
- #include <unordered_map>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(false);
- 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 res = 0;
- int cnt = 0;
- for(pair<int, int> p: mapa) {
- cnt += p.second;
- res = max(res, cnt);
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment