Skip to content

Instantly share code, notes, and snippets.

@Thiago4532
Created May 20, 2019 15:36
Show Gist options
  • Save Thiago4532/0d5d5e90e85bbf76154508f1ba8acf9f to your computer and use it in GitHub Desktop.
Save Thiago4532/0d5d5e90e85bbf76154508f1ba8acf9f to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int a[100100], b[100100], v[100100];
int main() {
int n, ans = 0;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
for(int i = 0; i < n; i++){
for(int j = a[i]; j <= b[i]; j++){
v[j]++;
}
}
for(int i = 1; i <= 100000; i++){
ans = max(ans, v[i]);
}
cout << ans << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment