#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair < ll, ll > ;
int main() {
ll r, x, y, i, can, X, Y, lo, hi, mid, n, j, ans, t, e;
cin >> n;
vector < pair < ll, ll > > vp;
for (i = 1; i<= n; i ++) {
cin >> x >> y;
vp.push_back({x, y});
}
stack < pll > S;
sort(vp.rbegin(), vp.rend());
for (i =0; i < vp.size(); i ++) {
x = vp[i].first;
y = vp[i].second;
while(!S.empty()) {
X = S.top().first;
Y = S.top().second;
if ( abs(x - X) <= y - Y) S.pop();
else break;
}
if ( S.empty()) {
S.push({x, y});
}
else {
X = S.top().first;
Y = S.top().second;
if ( abs(x - X) > Y - y){
S.push({x, y});
}
}
}
cout << S.size() << endl;
}
# | 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... |