#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 510000;
int n, x[N], y[N];
vector<array<int, 2>> vec;
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> x[i] >> y[i];
for (int i = 1; i <= n; i++)
vec.push_back({y[i] - x[i], y[i] + x[i]});
sort(begin(vec), end(vec));
stack<array<int, 2>> st;
for (auto [x, y] : vec) {
while (!st.empty() && st.top()[0] <= x && st.top()[1] <= y)
st.pop();
st.push({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... |