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;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, ans = 0;
cin >> n;
vector <pair <int, int>> a(n);
bool vis[n];
memset(vis, 0, sizeof vis);
for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
sort(a.begin(), a.end(), [&](pair <int, int>& a, pair <int, int>& b) {return a.second > b.second;});
for (int i = 0; i < n; ++i)
{
if (vis[i]) continue;
++ans;
for (int j = 0; j < n; ++j) if (abs(a[i].first - a[j].first) <= abs(a[i].second - a[j].second)) vis[j] = 1;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |