#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<pair<int, int>> a(n);
for (auto & [x, y]: a) {
cin >> x >> y;
auto x1 = x - y;
auto y1 = x + y;
x = x1;
y = y1;
}
sort(a.begin(), a.end());
// find upper hull
int ans = 0;
int xx = -1, yy = -1;
for (auto [x, y]: a) {
if (xx == x && yy <= y) {
xx = x;
yy = y;
} else if (y > yy) {
xx = x;
yy = y;
ans++;
}
}
cout << ans << '\n';
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... |