# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151639 | cos18 | King of Chairs (FXCUP4_chairs) | C++17 | 0 ms | 0 KiB |
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"
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
return W[0]*100 + W[1]*10 + W[2]*1;
}
#include "vassal.h"
#include <algorithm>
long long BB;
int N;
std::vector<int> realC;
int find(int target, int start, int end){
int location = (start+end)/2;
if(target==realC[location]) return location;
if(start==end){
if(target>realC[location]) return location;
return location-1;
}
if(target>realC[location]) return find(target, start, location-1);
return find(target, location+1, end);
}
void Init(long long B, std::vector<int> C){
N = C.size();
realC = C;
sort(realC.begin(), realC.end());
}
int Maid(int W){
int location = find(W, 0, realC.size());
if(location>=0){
realC.erase(realC.at(location));
return location;
}
return -1;
}