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()
{
int n; cin >> n;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++){
cin >> a[i].second >> a[i].first;
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
vector<int> color(n);
int cnt = 1;
for (int i = 0; i < n; i++){
if (color[i]) continue;
color[i] = cnt;
for (int j = i + 1; j < n; j++){
if (color[j]) continue;
if (abs(a[i].second - a[j].second) <= abs(a[i].first - a[j].first)){
color[j] = cnt;
}
}
cnt++;
}
/*for (int i = 0; i < n; i++){
cout << color[i] << ' ';
}
cout << endl;*/
cout << cnt - 1 << endl;
}
# | 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... |