Submission #149664

# Submission time Handle Problem Language Result Execution time Memory
149664 2019-09-01T06:55:40 Z 오리버스부릉부릉(#3679, rdd6584, orihehe, phpark) King of Chairs (FXCUP4_chairs) C++17
0 / 100
57 ms 4284 KB
#include "king.h"
using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	return 1;
}
#include "vassal.h"
#include <vector>
#include <algorithm>
#define pii pair<int,int>
using namespace std;

vector<pii> vec;
long long n;
int p[100001];
int find(int a) {
	if (p[a] == a) return a;
	return p[a] = find(p[a]);
}
void merge(int a, int b) {
	a = find(a);
	b = find(b);
	if (a == b) return;
	p[b] = a;
}
void Init(long long B, std::vector<int> C){
	int N = C.size();
	for (int i = 0; i < N; i++) {
		p[i] = i;
		vec.push_back({ C[i],i });
	}
	n = N;
	for (int i = 0; i < n; i++) {
		p[i] = i;
	}
	sort(vec.begin(), vec.end());
}

int Maid(int W){
	int idx = lower_bound(vec.begin(), vec.end(), pii(W, -1)) - vec.begin();
	idx++;
	idx = find(idx);
	if (idx != 0) {
		merge(idx - 1, idx);
		return vec[idx - 1].second;
	}

	return -1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1048 KB Wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 51 ms 4284 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 57 ms 4280 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -