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 "teams.h"
#include <bits/stdc++.h>
struct cmp {
constexpr bool operator () (const std::pair <int, int>& u, const std::pair <int, int>& v) const {
return u.second < v.second;
}
};
int n;
std::vector <std::pair <int, int>> v;
void init(int N, int a[], int b[]) {
v.resize(n = N);
for (int i = 0; i < n; i++) {
v[i] = { a[i], b[i] };
}
std::sort(v.begin(), v.end());
}
int can(int m, int k[]) {
std::sort(k, k + m);
std::multiset <std::pair <int, int>, cmp> st;
int ptr = 0;
for (int i = 0; i < m; i++) {
while (ptr < n && v[ptr].first <= k[i]) {
st.insert(v[ptr++]);
}
int need = k[i];
while (need && st.size()) {
auto it = st.begin();
if (it->second < k[i]) {
st.erase(it);
continue;
}
need--;
st.erase(it);
}
if (need) {
return false;
}
}
return true;
}
# | 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... |