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 <set>
#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());
std::multiset<int> S(C.begin(), C.end());
long long ans = 0;
for(auto val : W) {
auto it = S.lower_bound(val);
if(it == S.end()) {
break;
} else {
ans = val;
S.erase(it);
}
}
return ans;
}
#include "vassal.h"
#include <set>
using namespace std;
long long BB;
std::set<pair<int ,int>> S;
void Init(long long B, std::vector<int> C){
int N = C.size();
BB = B;
for(int i = 0; i < N; i += 1) {
S.insert(make_pair(C[i], i));
}
}
int Maid(int W){
if(W <= BB) {
auto it = S.lower_bound(make_pair(W, 0));
if(it != S.end()) {
int ret = (*it).second;
S.erase(it);
return ret;
} else {
return -1;
}
} else {
return -1;
}
}
Compilation message (stderr)
king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:7:6: warning: unused variable 'N' [-Wunused-variable]
int N = W.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... |