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"
#include <algorithm>
struct abc {
int idx, val;
bool operator <(abc a)const {
return val < a.val;
}
};
std::vector<abc> w, c;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int n = W.size();
for (int i = 0; i < n; i++) {
w.push_back({ i,W[i] });
c.push_back({ i,C[i] });
}
std::sort(w.begin(), w.end());
std::sort(c.begin(), c.end());
std::sort(W.begin(), W.end());
std::sort(C.begin(), C.end());
int j = 0, prvj = -1;
int ret = 0;
for (int i = 0; i < n; i++) {
while (j < n && W[i] > C[j]) j++;
if (j >= n) {
return prvj;
}
prvj = j;
ret++;
j++;
}
return prvj;
}
#include "vassal.h"
#include <map>
long long b;
long long bth;
struct abc {
int idx, val;
bool operator <(abc a)const {
return val < a.val;
}
};
static std::map<int, int> mp;
int maxidx;
void Init(long long B, std::vector<int> C){
int N = C.size();
b = B;
for (int i = 0; i < N; i++) {
mp[C[i]] = i;
}
int cnt = 0;
for (auto it : mp) {
if (cnt == b) {
bth = it.first;
}
cnt++;
}
}
int Maid(int W){
auto it = mp.lower_bound(W);
if (it->first > bth || it == mp.end()) return -1;
int ret = it->second;
mp.erase(W);
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |