# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787068 | GusterGoose27 | Teams (IOI15_teams) | C++17 | 4066 ms | 11884 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>
using namespace std;
typedef pair<int, int> pii;
const int MAXN = 1e5+5;
pii students[MAXN];
int n;
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; i++) {
students[i] = pii(A[i]-1, B[i]-1);
}
sort(students, students+n);
}
int can(int m, int k[]) {
sort(k, k+m);
int j = 0;
priority_queue<int, vector<int>, greater<int>> active;
for (int i = 0; i < m; i++) {
k[i]--;
while (j < n && students[j].first <= k[i]) {
active.push(students[j++].second);
}
while (!active.empty() && active.top() < k[i]) active.pop();
for (int j = 0; j <= k[i]; j++) {
if (active.empty()) return 0;
active.pop();
}
}
return 1;
}
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... |