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;
#define int long long
#define pii pair<long long, long long>
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> t(n), e(n), x(n), y(n);
for (int i = 0; i < n; i++) cin >> t[i] >> e[i];
vector<pii> xy(n);
for (int i = 0; i < n; i++) xy[i] = {t[i] - e[i], - t[i] - e[i]};
sort(xy.begin(), xy.end());
for (int i = 0; i < n; i++) {
x[i] = xy[i].first;
y[i] = -xy[i].second;
}
int h = -1e17, ans = 0;
for (int i = 0; i < n; i++) {
if (y[i] > h) ans++;
h = max(h, y[i]);
}
cout << ans << "\n";
}
# | 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... |