#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair <ll, ll >;
bool cmp(pll A, pll B) {
if ( A.first == B.first) return A.second < B.second;
return A.first > B.first;
}
int main() {
ll r, x, y, i, X,mx, Y, can, 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, x + y});
}
stack < pll > S;
sort(vp.rbegin(), vp.rend(), cmp);
mx = -1e9 -1;
ans = 0;
for (i =0; i < vp.size(); i ++) {
if ( vp[i].second > mx) {
mx = vp[i].second;
ans ++;
}
}
cout << ans << 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... |