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(false);
cin.tie(NULL);
cout.tie(NULL);
int n,a,br = 0,b;
cin >> n;
priority_queue<pair<int,int>> idk;
vector<pair<int,int>> haha(n);
vector<bool> bruh(n,true);
for(int i = 0; i < n; i++) {
cin >> a >> b;
idk.push({b,i});
haha[i] = {a,b};
}
while(!idk.empty()) {
a = idk.top().first;
b = idk.top().second;
idk.pop();
if(bruh[b]) {
for(int i = 0; i < n; i++) {
if(abs(haha[b].first-haha[i].first) <= haha[b].second-haha[i].second) {
bruh[i] = false;
}
}
br++;
}
}
cout << br;
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... |