#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> a, b, p;
void init(int N, int A[], int B[]) {
a.resize(N);
p.resize(N); iota(p.begin(), p.end(), 0);
for (int i = 0; i < N; i++) {
a[i] = A[i];
b[i] = B[i];
}
sort(p.begin(), p.end(), [&](int x, int y) {
if (a[x] == a[y]) return b[x] < b[y];
return a[x] < a[y];
});
}
int can(int M, int K[]) {
sort(K, K + M);
int ind = 0, n = (int)a.size();
set<pair<int, int>> st;
for (int i = 0; i < M; i++) {
while (!st.empty() && st.begin()->first < K[i]) st.erase(st.begin());
while (ind < n && a[p[ind]] <= K[i]) {
st.insert({b[p[ind]], ind});
ind++;
}
if ((int)st.size() < K[i]) {
return 0;
}
for (int it = 0; it < K[i]; it++) {
st.erase(st.begin());
}
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
3540 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
3600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
38 ms |
16232 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |