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;
typedef long long ll;
bool compare(pair<ll,ll> a, pair<ll,ll> b) {
if (a.first==b.first) {
return a.second>b.second;
}
return a.first<b.first;
}
int main() {
int n; cin>>n;
vector<pair<ll,ll>> res(n);
for (int i=0; i<n; i++) {
ll x,e; cin>>x>>e;
res[i].first=x-e;
res[i].second=x+e;
}
sort(res.begin(),res.end(),compare);
ll max_h=0;
ll ans=0;
for (int i=0; i<n; i++) {
if (res[i].second>max_h) {
ans++;
max_h=res[i].second;
}
}
cout<<ans;
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... |