#include "king.h"
using namespace std;
long long SendInfo(vector <int> W, vector <int> C)
{
return 1;
}
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include "vassal.h"
using namespace std;
static multiset <int> sit;
static vector <int> chair;
static int N;
void Init(long long B, vector <int> C)
{
N = C.size();
chair.resize(N);
chair = C;
for (int i = 0; i < N; i++) sit.insert(chair[i]);
}
int Maid(int w)
{
int left = 0, right = N, mid = 0;
auto itr = sit.lower_bound(w);
if (itr == sit.end()) {
return -1;
}
else {
int ans = *itr;
int idx = 0;
while (right <= left) {
if (ans < chair[mid]) {
right = mid - 1;
}
else if (chair[mid] < ans) {
left = mid + 1;
}
else {
idx = mid;
}
}
sit.erase(sit.find(ans));
return (int)idx;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
632 KB |
Correct |
2 |
Runtime error |
4 ms |
768 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
53 ms |
5816 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
55 ms |
5928 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |