Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <map>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(false);
- int n;
- cin >> n;
- map<int, int> c;
- vector<int> v(n + 1);
- // map<key, value> c ,key: type, value: type
- // c["stefan"] = 1
- // cout << c[ime], ime = "stefan"
- for(int i = 0; i < n; ++i) {
- int a, b;
- cin >> a >> b;
- ++c[a];
- --c[b + 1];
- }
- int ret = 0, pref_sum = 0;
- for(map<int, int>::iterator it = c.begin(); it != c.end(); ++it) {
- pref_sum += it->second;
- ret = max(ret, pref_sum);
- }
- cout << ret << endl;
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment