Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <iostream>
#include <algorithm>
using namespace std;
int imos[1000100] = {};
int main(){
int N; cin >> N;
for (int i = 0; i < N; i++){
int a, b; cin >> a >> b;
imos[a]++;
imos[b + 1]--;
}
for (int i = 1; i < 1000100; i++) imos[i] += imos[i - 1];
sort(imos, imos + 1000100);
reverse(imos, imos + 1000100);
cout << imos[0] << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment