Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created August 27, 2023 02:19
Show Gist options
  • Save estelabn/fe3ec6d5a4797874772d9b164317b26e to your computer and use it in GitHub Desktop.
Save estelabn/fe3ec6d5a4797874772d9b164317b26e to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> v;
for(int i=0; i<n; i++){
int c,p;
cin >> c >> p;
v.push_back({c,1});
v.push_back({p,-1});
}
sort(v.begin(), v.end());
int qnt = 0, maxQnt = 0, instanteAnterior = -1;
for(int i = 0; i<v.size(); i++){
int instante = v[i].first, valor = v[i].second;
if(instanteAnterior != instante) maxQnt = max(maxQnt, qnt);
qnt += valor;
instanteAnterior = instante;
}
maxQnt = max(qnt, maxQnt);
cout << maxQnt*20 << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment