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<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=500005;
int n,x[N],e[N],b[N],q[N],tot;
pair<int,int> a[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x[i]>>e[i];
a[i]=make_pair(e[i]-x[i],x[i]+e[i]);
}
sort(a+1,a+1+n);
for(int i=1;i<=n;i++)
{
while(tot&&a[q[tot]].second<=a[i].second)tot--;
q[++tot]=i;
}
cout<<tot<<endl;
return 0;
}
# | 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... |