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;
#define pb push_back
#define ll long long
int n,a[100005],b[100005];
vector<int> vec[100005];
bitset<100005> matched;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
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 = 1; i <= n; ++i)
for (int j = 0; j < n; ++j)
if(a[j]<=i && i<=b[j])vec[i].pb(j);
}
int can(int M, int K[]) {
sort(K,K+M);
matched=0;
for (int i = 0; i < M; ++i)
{
for (int j = 0; j < K[i]; ++j)
{
int mini=(int)1e9,idx;
for(auto it:vec[K[i]]){
if(matched[it])continue;
if((b[it]-K[i])<mini){
mini=b[it]-K[i];
idx=it;
}
}
if(mini==(int)(1e9))return 0;
matched[idx]=1;
}
}
return 1;
}
# | 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... |