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;
struct T
{
int x;
int y;
};
bool good(T a, T b)
{
return a.x <= b.x && a.y <= b.y;
}
bool operator < (T a, T b)
{
if (a.y == b.y)
{
return a.x < b.x;
}
return a.y < b.y;
}
const int N = 10000000 + 7;
int n;
T v[N];
int dp[N];
signed main()
{
#ifdef ONPC
freopen ("input.txt", "r", stdin);
#endif // ONPC
#ifndef ONPC
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC
///gen();
cin >> n;
for (int i = 1; i <= n; i++)
{
int x, y;
cin >> v[i].x >> v[i].y;
x = -(v[i].x + v[i].y);
y = (v[i].x - v[i].y);
v[i].x = x;
v[i].y = y;
}
sort(v + 1, v + n + 1);
int mn = v[1].x, cnt = 1;
for (int i = 2; i <= n; i++)
{
if (v[i].x < mn)
{
mn = v[i].x;
cnt++;
}
}
cout << cnt << "\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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |