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;
using vi = vector<int>;
using ll = long long;
using ii = pair<int, int>;
const int maxn = 2e5 + 5;
int A[maxn], B[maxn], N;
vi g[maxn];
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 = 0; i < N; i++) {
g[B[i]].push_back(A[i]);
}
}
int can(int M, int K[]) {
int k = N;
for(ll i = 0, s = 0; i < M; ++i) {
if((s += K[i]) > N) return 0;
k -= K[i];
}
vi cnt(N+1);
for(int i = 0; i < M; ++i) {
cnt[K[i]] += K[i];
}
for(int i = 1; i <= N; ++i) {
int x = 0, y = 0;
for(int j = i; j <= N; ++j) {
x += cnt[j];
for(int l : g[j]) {
if(l >= i) ++y;
}
if(y-k > x) return 0;
}
}
return 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... |