# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958847 | 12345678 | Teams (IOI15_teams) | C++17 | 4075 ms | 12344 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;
const int nx=1e5+5;
int n, cur;
vector<pair<int, int>> v;
void init(int N, int A[], int B[]) {
n=N;
for (int i=0; i<N; i++) v.push_back({A[i], B[i]});
sort(v.begin(), v.end());
}
int can(int M, int K[]) {
sort(K, K+M);
cur=0;
priority_queue<int, vector<int>, greater<int>> pq;
for (int i=0; i<M; i++)
{
while (cur<n&&v[cur].first<=K[i]) pq.push(v[cur++].second);
while (!pq.empty()&&pq.top()<K[i]) pq.pop();
if (pq.size()<K[i]) return 0;
while (K[i]--) pq.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... |