Submission #153160

# Submission time Handle Problem Language Result Execution time Memory
153160 2019-09-12T15:47:23 Z phpark King of Chairs (FXCUP4_chairs) C++17
0 / 100
41 ms 5376 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;
vector <int> chair;
void Init(long long B, vector <int> C)
{
	copy(C.begin(), C.end(), chair.begin());
    sort(chair.begin(), chair.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 (chair[mid] > w) {
			right = mid - 1;
			if (right <= left) {
				res = mid;
				break;
			}
		}
		else if (chair[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 Runtime error 4 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 5176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 5376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -