This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define F first
#define S second
using namespace std;
signed main(){
int n;
cin>>n;
vector<pii> vp(n);
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
vp[i]={a-b,a+b};
}
sort(vp.begin(),vp.end(),[](auto i,auto j){
if(i.F==j.F) return i.S>j.S;
return i.F<j.F;
});
int ans=0,mx=-1e18;
for(int i=0;i<n;i++){
if(vp[i].S>mx) ans++;
mx=max(mx,vp[i].S);
}
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |