답안 #151666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151666 2019-09-04T04:27:49 Z cos18 King of Chairs (FXCUP4_chairs) C++17
0 / 100
1000 ms 4248 KB
#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) {
		location = (start + end) / 2;
		if (W == realC[location]) break;
		if (start == end) {
			if (W > realC[location]) 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 644 KB Correct
2 Execution timed out 1077 ms 636 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 3932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1091 ms 4248 KB Time limit exceeded
2 Halted 0 ms 0 KB -