#include "king.h"
#include <vector>
#include <algorithm>
using namespace std;
struct abc {
int idx, val;
bool operator <(abc a)const {
return val < a.val;
}
};
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] });
}
sort(w.begin(), w.end());
sort(c.begin(), c.end());
sort(W.begin(), W.end());
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++;
}
return prvj;
}
#include "vassal.h"
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
long long b;
struct abc {
int idx, val;
bool operator <(abc a)const {
return val < a.val;
}
};
vector<abc> c;
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++) {
c.push_back({ i,C[i] });
mp[C[i]] = i;
}
sort(c.begin(), c.end());
}
int Maid(int W){
auto it = mp.lower_bound(W);
if (it->second > b) return -1;
int ret = it->second;
mp.erase(W);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
1060 KB |
Correct |
2 |
Runtime error |
10 ms |
1060 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
70 ms |
7196 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
80 ms |
7248 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |