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>
using namespace std;
long long SendInfo(std::vector<int> w, std::vector<int> c) {
int n = w.size();
sort(w.begin(), w.end());
sort(c.begin(), c.end());
int cnt = 0;
int i, j;
for (i = j = n - 1; i >= 0 && j >= 0;)
{
if (w[i] > c[j]) i--;
else if (w[i] <= c[j]) {
cnt++;
i--;
j--;
}
}
if (cnt == 0) return 0;
return w[cnt-1];
}
#include "vassal.h"
#include<algorithm>
using namespace std;
long long m;
int n;
typedef pair<int, int> pii;
pii v[100009];
void Init(long long mm, std::vector<int> c){
n = c.size();
m = mm;
// ToDo
for (int i = 0; i < n; i++) {
v[i].first = c[i];
v[i].second = i;
}
sort(v, v + n);
}
int Maid(int w){
if(w>m) return -1;
return v[lower_bound(v, v + n, pii(w, -1)) - v].second;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |