#include <bits/stdc++.h>
typedef int valueType;
typedef std::pair<valueType, valueType> ValuePair;
typedef std::vector<ValuePair> PairVector;
typedef std::stack<ValuePair> Stack;
int main() {
valueType N;
std::cin >> N;
PairVector source(N);
for (auto &iter: source) {
valueType X, E;
std::cin >> X >> E;
iter = std::make_pair(E - X, E + X);
}
std::sort(source.begin(), source.end());
Stack stack;
for (auto const &iter: source) {
while (!stack.empty() && stack.top().second <= iter.second)
stack.pop();
stack.push(iter);
}
std::cout << stack.size() << std::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... |