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>
std::vector<int> realC;
int check[100000] = {};
int N;
int find(int target, int start, int end) {
int location = (start + end) / 2;
if (target == realC[location]) return location;
if (start == end) {
if (target > realC[location]) return location;
return location - 1;
}
if (target > realC[location]) return find(target, location+1, end);
return find(target, start, location-1);
}
void Init(long long B, std::vector<int> C) {
realC = C;
sort(realC.begin(), realC.end());
N = realC.size();
}
int Maid(int W) {
int location = find(W, 0, N-1);
if (location == N - 1 && realC[location] < W) return -1;
while (location >= 0) {
if (!check[location]) {
check[location] = 1;
break;
}
location--;
}
return location;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |