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>
using namespace std;
#define int long long
#define X first
#define Y second
int mod=998244353;
int n;
pair<int,int>ar[500005];
signed main() {
cin>>n;
for(int i=1;i<=n;i++){
int x;int y;
cin>>x>>y;
ar[i].X=x-y;
ar[i].Y=x+y;
ar[i].Y*=-1;
}
sort(ar+1,ar+n+1);
for(int i=1;i<=n;i++){
ar[i].Y*=-1;
}
int ans=n;
int mxh=ar[1].Y;
for(int i=2;i<=n;i++){
if(ar[i].Y<=mxh){
ans--;
}
mxh=max(mxh,ar[i].Y);
}
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... |