Problem Link

<Source Code>

#include<bits/stdc++.h>
#define ll long long
#define pr pair<ll,ll>
using namespace std;
int main()
{
long long n,i;
cin>>n;
pr b[n];
for(int i=0;i<n;i++)
{
cin>>b[i].first>>b[i].second;}
sort(b,b+n);
ll mx=b[0].second;
ll res=0;
for(i=1;i<n;i++){
if(mx>=b[i].second)
res++;
else mx=b[i].second;
}
co

### Like this:

Like Loading...