Submission #153174

# Submission time Handle Problem Language Result Execution time Memory
153174 2019-09-12T17:05:29 Z phpark King of Chairs (FXCUP4_chairs) C++17
0 / 100
55 ms 7012 KB
#include "king.h"
using namespace std;
long long SendInfo(vector <int> W, vector <int> C)
{
	return 1;
}
#include <set>
#include <vector>
#include <algorithm>
#include "vassal.h"
using namespace std;
set <int> sit;
int N;
extern vector <int> C;
void Init(long long B, vector <int> C)
{
	
    sort(C.begin(), C.end());
    N = C.size();
	for (int i = 0; i < N; i++) sit.insert(i);
}
 
int Maid(int w)
{
	int right = 0, left = 0, mid = 0, res = 0;
	while (right <= left) {
		mid = (right + left) / 2;
		if (C[mid] > w) {
			right = mid - 1;
			if (right <= left) {
				res = mid;
				break;
			}
		}
		else if (C[mid] < w) {
			left = mid + 1;
			if (right <= left) {
				res = right;
				break;
			}
		}
		else {
			res = mid;
			break;
		}
	}
	
	auto itr = sit.upper_bound(res);
	if (itr == sit.end()) {
		return -1;
	}
	else {
		int answer = *itr;
		sit.erase(itr);
			
		return answer;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 644 KB Wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 51 ms 6832 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 7012 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -