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>
#include "teams.h"
using namespace std;
typedef pair<int, int> pi;
int N;
vector<pi> students;
void init(int n, int A[], int B[])
{
N = n;
students.resize(N);
for (int i = 0; i < N; i++) {
students[i] = {A[i], B[i]};
}
sort(students.begin(), students.end());
}
int can(int M, int K[])
{
sort(K, K + M);
int p = 0;
priority_queue<int, vector<int>, greater<int>> q;
for (int i = 0; i < M; i++) {
while (p < N && students[p].first <= K[i]) {
q.push(students[p].second);
p++;
}
while (!q.empty() && q.top() < K[i]) {
q.pop();
}
for (int j = 0; j < K[i]; j++) {
if (q.empty()) {
return 0;
}
q.pop();
}
}
return 1;
}
# | 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... |