# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
540855 | GioChkhaidze | Teams (IOI15_teams) | C++14 | 4034 ms | 59276 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 pb push_back
using namespace std;
const int Nn = 5e5 + 5;
int n, a[Nn], b[Nn], f[Nn];
vector < int > G[Nn];
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; ++i) {
a[i] = A[i], b[i] = B[i];
}
for (int i = 0; i < N; ++i) {
G[A[i]].pb(i);
}
}
int can(int M, int K[]) {
for (int i = 0; i < M; ++i) {
f[K[i]]++;
}
multiset < int > st;
bool ok = true;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < G[i].size(); ++j) {
int id = G[i][j];
st.insert(b[id]);
}
for (int j = 1; j <= f[i] * i; ++j) {
if (!st.size()) {
ok = false;
break;
}
if ((*st.begin()) < i) {
ok = false;
break;
}
st.erase(st.find(*st.begin()));
}
if(!ok) break;
}
for (int i = 0; i < M; ++i) {
f[K[i]] = 0;
}
return ok;
}
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... |