This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
_ _ __ _ _ _ _ _ _
|a ||t ||o d | |o |
| __ _| | _ | __| _ |
| __ |/_ | __ /__\ / _\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
int X[N], Y[N];
for (int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
X[i] = y + x;
Y[i] = y - x;
}
int order[N];
iota(order, order + N, 0);
sort(order, order + N, [&] (const int &i, const int &j) {
return make_pair(X[i], Y[i]) < make_pair(X[j], Y[j]);
});
int mx = INT_MIN;
int answer = 0;
for (int i = N - 1; i >= 0; i--) {
if (Y[order[i]] > mx) {
mx = Y[order[i]];
answer++;
}
}
cout << answer << "\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... |