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;
int main() {
int N;
cin >> N;
vector<pair<int, int>> points(N);
for (int i = 0; i < N; i++) {
int X, E;
cin >> X >> E;
points[i] = {X - E, X + E};
}
sort(points.begin(), points.end(), [] (auto &i, auto &j) {
if (i.first != j.first) return i.first < j.first;
return i.second > j.second;
});
int maxi = -1;
int count = 0;
for (auto i : points) {
if (maxi < i.second) {
maxi = i.second;
count++;
}
}
cout << count << 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... |