Submission #151667

#TimeUsernameProblemLanguageResultExecution timeMemory
151667cos18King of Chairs (FXCUP4_chairs)C++17
0 / 100
40 ms3544 KiB
#include "king.h"

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	return 0;
}
#include "vassal.h"
#include <algorithm>

std::vector<int> realC;
int check[100000] = {};
int N;


void Init(long long B, std::vector<int> C) {
	realC = C;
	// sort(realC.begin(), realC.end());
	N = realC.size();
}

int Maid(int W) {
	int start = 0, end = N - 1;
	int location = (start + end) / 2;

	while (true) {
		if (start >= end) {
			if (W > realC[location]) location++;
			break;
		}
		location = (start + end) / 2;
		if (W == realC[location]) break;
		if (W > realC[location]) start = location+1;
		else end = location - 1;
	}

	if (location == N - 1 && realC[location] < W) return -1;
	while (location < N) {
		if (!check[location]) {
			check[location] = 1;
			break;
		}
		location++;
	}
	if (location == N) return -1;
	return location;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...