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<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<limits.h>
#include<math.h>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<iomanip>
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD=1e9+7;
//typedef pair<ll,ll>Point;
//typedef pair<ll,ll>Line;
//#define x first
//#define y second
bool cmp(pair<int,int>a,pair<int,int>b){
if(a.first==b.first)
return a.second>b.second;
return a.first<b.first;
}
int main(){
ios::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int n;
cin>>n;
vector<pair<int,int>>arr(n);
for(auto&i:arr){
int x,a;
cin>>x>>a;
i={x-a,x+a};
}
sort(arr.begin(),arr.end(),cmp);
int cov=-2e9;
int res=0;
for(auto i:arr){
if(i.second>cov){
cov=i.second;
res++;
}
}
cout<<res<<"\n";
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... |