This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<pair<ll, ll>>v;
for (int i = 1; i <= n; i++) {
ll x, e; cin >> x >> e;
v.push_back({ e-x, e + x});
}
sort(v.begin(), v.end());
stack<ll>stk;
for (int i = 0; i < n; i++) {
while (stk.size() && v[i].second >= stk.top()) stk.pop();
stk.push(v[i].second);
}
cout << stk.size() << "\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... |