# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777504 | boris_mihov | Teams (IOI15_teams) | C++17 | 4033 ms | 33860 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 <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <queue>
typedef long long llong;
const int MAXN = 500000 + 10;
const int INF = 1e9;
int n;
std::vector <int> v[MAXN];
void init(int N, int A[], int B[])
{
n = N;
for (int i = 0 ; i < n ; ++i)
{
v[A[i]].push_back(B[i]);
}
}
std::priority_queue <int> pq;
int can(int M, int K[])
{
while (!pq.empty())
{
pq.pop();
}
int ptr = 0;
std::sort(K, K + M);
for (int i = 0 ; i < M ; ++i)
{
while (ptr + 1 <= K[i])
{
ptr++;
for (const int &j : v[ptr])
{
pq.push(-j);
}
}
while (pq.size() && -pq.top() < K[i])
{
pq.pop();
}
if (pq.size() < K[i])
{
return 0;
}
for (int j = 0 ; j < K[i] ; ++j)
{
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... |