제출 #782329

#제출 시각아이디문제언어결과실행 시간메모리
782329AndreyAdvertisement 2 (JOI23_ho_t2)C++14
59 / 100
2052 ms4812 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...