#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
using namespace std;
int main() {
int n; cin >> n;
pair<int,int> a[n];
// x[j] - x[i] <= e[i] - e[j]
// x[j] + e[j] <= e[i] + x[i]
//
// x[i] - x[j] <= e[i] - e[j]
// e[j] - x[j] <= e[i] - x[i]
//
// X[j] <= X[i]
// Y[j] <= Y[i]
for (auto& [x, y] : a) {
int pos, inf; cin >> pos >> inf;
x = inf + pos;
y = -(inf - pos);
}
sort(a, a+n, greater<>());
multiset<int> lis;
for (auto [x, y] : a) {
auto it = lis.upper_bound(y);
if (it != lis.begin())
lis.erase(prev(it));
lis.insert(y);
}
cout << lis.size();
}
# | 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... |