# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131390 | antimirage | Teams (IOI15_teams) | C++14 | 934 ms | 10804 KiB |
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>
#define fr first
#define sc second
using namespace std;
const int N = 1e5 + 5;
int cn[N], n;
pair <int, int> a[N];
void init(int N, int l[], int r[]) {
n = N;
for (int i = 0; i < n; i++) {
a[i] = {r[i], l[i]};
}
sort(a, a + n);
}
int can(int m, int k[]) {
sort(k, k + m);
int j = 0;
priority_queue <pair <int, int> > q;
for (int i = 0; i < m; i++) {
int cn = k[i];
while (j < n && cn > 0) {
q.push({-a[j].sc, a[j].fr});
while (!q.empty() && q.top().sc < k[i]) q.pop();
if (-q.top().fr <= k[i]) {
cn--;
q.pop();
}
j++;
}
while (!q.empty() && cn > 0 && -q.top().fr <= k[i]) {
cn--;
q.pop();
}
if (j == n && cn > 0)
return false;
}
return true;
}
Compilation message (stderr)
# | 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... |