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>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
int n;
vector<pair<int, int>> c;
void init(int n_, int a[], int b[]) {
n = n_;
for (int i = 0; i < n; i++) {
c.emplace_back(a[i], b[i]);
}
sort(c.begin(), c.end());
}
int can(int m, int k[]) {
if (accumulate(k, k + m, 0LL) > n) {
return 0;
}
sort(k, k + m);
vector<pair<int, int>> d;
for (int i = 0, j = 0; i < m; i = j) {
while (j < m && k[i] == k[j]) {
j++;
}
d.emplace_back(k[i], j - i);
}
int sz = (int) d.size();
auto Solve = [&](int l, int r) {
int res = 0;
for (int i = 0; i < n; i++) {
if (l <= c[i].first && c[i].second <= r) {
res++;
}
}
return res;
};
for (int i = 0; i < sz; i++) {
int my_cnt = 0;
for (int j = i; j < sz; j++) {
my_cnt += d[j].second;
int they_cnt = n;
they_cnt -= Solve(1, d[i].first - 1);
for (int l = i; l < j; l++) {
they_cnt -= Solve(d[l].first + 1, d[l + 1].first - 1);
}
they_cnt -= Solve(d[j].first + 1, n);
if (my_cnt > they_cnt) {
return 0;
}
}
}
return 1;
}
#ifdef tabr
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
return 0;
}
#endif
# | 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... |