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 ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define vl vector<ll>
#define sl set<ll>
#define pb push_back
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define ld long double
using namespace std;
int main()
{
ll n, x, e, i;
cin >> n;
vector<pair<ll, ll>>points(n);
for(i = 0; i < n; i++)
{
cin >> x >> e;
points[i] = {x-e, x+e};
}
sort(points.begin(), points.end(), [](auto &i, auto &j)
{
if(i.f != j.f) return i.f < j.f;
return i.s > j.s;
});
ll maxx = -1, k = 0;
for(auto i : points) if(maxx < i.s) maxx = i.s, k++;
cout << k << "\n";
}
# | 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... |