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 "king.h"
long long SendInfo(std::vector<int> W, std::vector<int> C) {
return 0;
}
#include "vassal.h"
#include <algorithm>
struct data {
int c, pos;
};
bool cmp(const data& a, const data& b) {
return a.c < b.c;
}
int cnt, N, idx;
std::vector<data> C2;
bool check[100001];
void Init(long long B, std::vector<int> C) {
cnt = 0;
N = C.size();
idx = 0;
for (int i=0; i<N; i++) {
C2.push_back({C[i], i});
check[i] = false;
}
std::sort(C2.begin(), C2.end(), cmp);
}
int Maid(int W) {
if (N <= 10) {
for (int i=0; i<N; i++) {
if (check[i] || C2[i].c < W) continue;
check[C2[i].pos] = true;
return C2[i].pos;
}
return -1;
} else {
while (idx < N && C2[idx].c < W) {
idx++;
}
if (idx >= N) {
return -1;
} else {
return C2[idx++].pos;
}
}
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... |