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>
#include<iostream>
using namespace std;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
long long upper = 0;
sort(W.begin(), W.end());
sort(C.begin(), C.end());
int cnt = 0;
for (auto i : W) {
while (cnt<N && i > C[cnt]) cnt++;
if (cnt < N && i <= C[cnt]) { upper = i; cnt++; }
if (cnt >= N) break;
}
// cout<<"*"<<upper<<endl;
return upper;
}
#include "vassal.h"
#include<algorithm>
#include<iostream>
using namespace std;
long long BB;
std::vector<int>CC;
void Init(long long B, std::vector<int> C){
int N = C.size();
BB = B;
CC= C;
sort(CC.begin(), CC.end());
}
bool v[101010];
int Maid(int W){
if (BB < W) return -1;
int l=0, r=CC.size()-1, mid;
while (l<r) {
mid = (l+r) / 2;
//cout << l << mid << r << endl;
if (CC[mid] < W) l = mid + 1;
else r = mid;
}
while (r>0 && CC[r] == CC[r - 1]) r--;
while (v[r]) r++;
v[r] = 1;
//cout << "===" << r << endl;
return r;
}
Compilation message (stderr)
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |