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[200000] = {};
int N;
void Init(long long B, std::vector<int> C) {
realC = C;
// sort(realC.begin(), realC.end());
N = realC.size();
}
int Maid(int W) {
int start = 0, end = N - 1;
int location = (start + end) / 2;
while (true) {
if (start >= end) {
if (W > realC[location]) location++;
break;
}
location = (start + end) / 2;
if (W == realC[location]) break;
if (W > realC[location]) start = location+1;
else end = location - 1;
}
if (location == N - 1 && realC[location] < W) return -1;
while (location < N) {
if (!check[location]) {
check[location] = 1;
break;
}
location++;
}
if (location == N) return -1;
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... |