# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384499 | luciocf | Teams (IOI15_teams) | C++14 | 4078 ms | 10220 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 <bits/stdc++.h>
#include "teams.h"
#define ff first
#define ss second
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5+10;
int n;
pii range[maxn];
void init(int N, int A[], int B[])
{
n = N;
for (int i = 1; i <= n; i++)
range[i] = {A[i-1], B[i-1]};
sort(range+1, range+n+1);
}
int can(int M, int K[])
{
int m = M;
vector<int> V;
for (int i = 0; i < m; i++)
V.push_back(K[i]);
sort(V.begin(), V.end());
multiset<int> st;
int ptr = 1;
for (auto qtd: V)
{
while (ptr <= n && range[ptr].ff <= qtd)
st.insert(range[ptr++].ss);
if (st.size() < qtd) return 0;
int aux = 0;
for (auto it = st.begin(); aux < qtd && it != st.end(); it = st.erase(it))
if (*it >= qtd)
aux++;
if (aux < qtd) return 0;
}
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... |