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 P pair<int,int>
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
const int maxn = 110;
int cnt[maxn][maxn], n;
int used[maxn];
vector<P>intervals;
bool compare(P a, P b) {
if(a.second == b.second) return a.first > b.first;
else return a.second < b.second;
}
void init(int N, int A[], int B[]) {
n = N;
for(int i=1;i<=n;i++) {
for(int j=0;j<n;j++) {
if(i >= A[j] && i <= B[j]) {
cnt[i][B[j]]++;
}
}
}
}
int can(int M, int K[]) {
memset(used,0,sizeof(used));
sort(K, K + M);
int marked = 0;
for(int i=0;i<M;i++) {
marked = 0;
for(int j=1;j<=n;j++) {
if(cnt[K[i]][j] <= used[j]) continue;
int diff = cnt[K[i]][j] - used[j];
diff = min(diff, K[i] - marked);
used[j] += diff;
marked += diff;
if(marked == K[i]) break;
}
if(marked != K[i]) return false;
}
return true;
}
# | 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... |