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 long long ll;
ll n;
vector<pair<ll, ll>> a;
void init(int n1, int a1[], int b1[]) {
n = n1;
a = vector<pair<ll, ll>>(n);
for (int i = 0; i < n; i++) {
a[i].first = a1[i];
a[i].second = b1[i];
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
}
int can(int m, int k[]) {
vector<ll> q(m);
for (int i = 0; i < m; i++) q[i] = k[i];
sort(q.begin(), q.end());
reverse(q.begin(), q.end());
vector<bool> used(n);
for (auto &e : q) {
ll cnt = e;
for (int i = 0; i < n && cnt; i++) {
if (used[i]) continue;
pair<ll, ll> &s = a[i];
if (s.first > e) {
used[i] = true;
continue;
}
if (s.second >= e) {
used[i] = true;
cnt--;
}
}
if (cnt) return 0;
}
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... |