답안 #151668

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151668 2019-09-04T04:41:54 Z cos18 King of Chairs (FXCUP4_chairs) C++17
0 / 100
40 ms 3360 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[200000] = {};
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 632 KB Correct
2 Correct 4 ms 636 KB Correct
3 Runtime error 4 ms 760 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 37 ms 3196 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 40 ms 3360 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -