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"
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back
#define sz(x) int32_t(x.size())
#define all(x) x.begin(),x.end()
#define F first
#define S second
int n;
vector<pair<int, int>> v;
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; i++) {
v.pb({B[i], A[i]});
}
sort(all(v));
}
int can(int M, int K[]) {
sort(K, K+M);
int sm = 0;
for (int i = 0; i < M; i++) {
sm += K[i];
if (sm > n)return 0;
}
int id = 0, rem = K[0];
vector<bool> tk(n, false);
while (id < M) {
bool ff = false;
for (int i = 0; i < n; i++) {
if (tk[i])continue;
if (v[i].S <= K[id] && v[i].F >= K[id]) {
rem--;
tk[i] = true;
if (!rem) {
id++;
if (id < M)rem = K[id];
}
ff = true;
break;
}
}
if (!ff)break;
}
return (id == M);
}
# | 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... |