# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288968 | Berted | Teams (IOI15_teams) | C++14 | 35 ms | 8320 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 <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <bitset>
#include <queue>
#define pii pair<int, int>
#define fst first
#define snd second
const int SZ = (1 << 20) + 5, SZ2 = 500005;
using namespace std;
struct p_node
{
int v = 0, l = -1, r = -1;
p_node() {}
};
int n; pii a[105];
priority_queue<pii, vector<int>, greater<int>> pq;
void init(int N, int A[], int B[])
{
n = N;
for (int i = 0; i < N; i++) {a[i] = {A[i], B[i]};}
sort(a, a + N);
}
int can(int M, int K[])
{
sort(K, K + M);
while (pq.size()) {pq.pop();}
int j = 0;
for (int i = 0; i < M; i++)
{
for (; j < n && a[j].fst <= K[i]; j++) {pq.push(a[j].snd);}
while (pq.size() && pq.top() < K[i]) {pq.pop();}
if (pq.size() < K[i]) {return 0;}
else {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... |