#include<bits/stdc++.h>
using namespace std;
int n, x, y;
stack<pair<int, int>> st;
int main() {
// cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> x >> y;
if (st.empty()) {
st.emplace(x, y);
continue;
}
auto [tx, ty] = st.top();
if (abs(tx - x) <= ty - y) {
continue;
}
while (not st.empty() and abs(x - st.top().first) <= y - st.top().second) {
st.pop();
}
st.emplace(x, y);
}
cout << st.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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |