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;
using lint = long long;
using pint = pair<lint, lint>;
#define x first
#define y second
const int maxn = 10000004;
int n, k, b[maxn];
pint a[maxn];
int ccw(pint a, pint b, pint c) {
lint k = a.x*b.y + b.x*c.y + c.x*a.y - b.x*a.y - c.x*b.y - a.x*c.y;
if (k>0) return 1;
if (k<0) return -1;
return 0;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i=0; i<n; i++) {
int x, y;
cin >> x >> y;
a[i] = pint(x+y, y-x);
}
sort(a, a+n);
reverse(a, a+n);
n = unique(a, a+n, [](pint x, pint y) { return x.x == y.x; }) - a;
reverse(a, a+n);
for (int i=0; i<n; i++) {
while (k and b[k-1] <= a[i].y) k--;
b[k++] = a[i].y;
}
cout << k << '\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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |