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;
struct range
{
int l, r;
bool operator<(const range other) const
{
return r < other.r;
}
};
int N;
vector<range> v;
void init(int N_, int A[], int B[])
{
N = N_;
v.resize(N);
for (int i = 0; i < N; i++)
{
v[i] = {A[i], B[i]};
}
sort(v.begin(), v.end());
}
int can(int M, int K_[])
{
vector<int> K(M);
for (int i = 0; i < M; i++)
K[i] = K_[i];
sort(K.begin(), K.end());
int l = 0;
int remaining = K[0];
for (int i = 0; i < N; i++)
{
if (v[i].r >= K[l] && v[i].l <= K[l])
remaining--;
if (!remaining)
{
l++;
if (l == M) return 1;
remaining = K[l];
}
}
return 0;
}
# | 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... |