# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916145 | Trisanu_Das | Teams (IOI15_teams) | C++17 | 4030 ms | 23672 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> P;
P p[600000];
int n;
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < N; i++) p[i] = P(A[i], B[i]);
sort(p, p + N);
}
int can(int M, int K[]) {
sort(K, K + M);
priority_queue<P, vector<P>, greater<P>> que;
int s = 0;
for (int i = 0; i < M; i++) {
int x = K[i];
while (s < n && p[s].first <= x) que.push(P(p[s].second, p[s].first)), s++;
while (!que.empty() && que.top().first < x) que.pop();
if (que.size() < x) return 0;
for (int i = 0; i < x; i++) que.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... |