Submission #743710

#TimeUsernameProblemLanguageResultExecution timeMemory
743710vjudge1Teams (IOI15_teams)C++17
34 / 100
4101 ms18964 KiB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()

int n;
vector<pair<int, int>> g;

void init(int N, int A[], int B[]) {
    n = N;
    for (int i = 0; i < n; i++) {
        g.push_back({A[i], B[i]});
    }
    sort(all(g));
}
 
bool can(int M, int K[]) {
    sort(K, K + M);
    priority_queue<int> pq;
    for (int i = 0, j = 0; i < M; i++) {
        while (j < n && g[j].first <= K[i]) {
            pq.push(-g[j++].second);
        }
        while (pq.size() > 0 && -pq.top() < K[i]) {
            pq.pop();
        }
        while (K[i]--) {
            if (pq.size() == 0) return 0;
            pq.pop();
        }
    }
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...