Submission #153414

# Submission time Handle Problem Language Result Execution time Memory
153414 2019-09-14T06:42:38 Z phpark King of Chairs (FXCUP4_chairs) C++17
17 / 100
69 ms 7248 KB
#include "king.h"
using namespace std;
long long SendInfo(vector <int> W, vector <int> C)
{
	return 1;
}
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include "vassal.h"
using namespace std;
static multiset <int> sit;
static vector <int> chair;
static int N;
void Init(long long B, vector <int> C)
{
	N = C.size();
	chair.resize(N);
	sort(C.begin(), C.end());
	chair = C;
	
	for (int i = 0; i < N; i++) sit.insert(chair[i]);
}

int Maid(int w)
{
	auto itr = sit.lower_bound(w);
	if (itr == sit.end()) {
		return -1;
	}
	else {
		int ans = *itr;
		auto it = find(chair.begin(), chair.end(), ans);
		auto index = distance(chair.begin(), it);
		
		sit.erase(sit.find(ans));
		return (int)index;
	}
	
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 884 KB Correct
2 Correct 4 ms 636 KB Correct
3 Correct 4 ms 768 KB Correct
4 Correct 4 ms 1008 KB Correct
5 Correct 4 ms 880 KB Correct
# Verdict Execution time Memory Grader output
1 Runtime error 53 ms 7092 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 69 ms 7248 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -