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>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 500'010;
pll a[N];
int n;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
// 1 - 1i
// (x + y) + (-x + y)i
cin >> n;
Loop (i,0,n) {
ll x, y;
cin >> x >> y;
a[i] = {
x + y,
-x + y,
};
}
sort(a, a+n);
vector<ll> vec;
Loop (i,0,n) {
while (vec.size() && vec.back() <= a[i].second)
vec.pop_back();
vec.push_back(a[i].second);
}
cout << vec.size() << '\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... |