답안 #148405

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148405 2019-09-01T04:18:48 Z 잉여로운 고3(#3749, imyujin, sebinkim) King of Chairs (FXCUP4_chairs) C++17
100 / 100
120 ms 7380 KB
#include "king.h"

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	return 0;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;

const int MAXN = 100005;

long long B;
pii cs[MAXN];
int C[MAXN];
int uni[MAXN];
int N;

int guni(int x) { return x == uni[x] ? x : uni[x] = guni(uni[x]); }

void Init(long long BB, std::vector<int> C){
	N = C.size();
	B = BB;
	BB = B;

	for(int i = 0; i < N; i++) ::C[i] = C[i];
	for(int i = 0; i < N; i++) cs[i] = make_pair(C[i], i);
	sort(cs, cs + N);
	for(int i = 0; i <= N; i++) uni[i] = i;
}

int Maid(int W){
	int l = lower_bound(cs, cs + N, make_pair(W, 0)) - cs;
	int t = guni(l);
	if(t == N) return -1;
	uni[t] = uni[t + 1];
	return t;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1056 KB Correct
2 Correct 10 ms 1044 KB Correct
3 Correct 11 ms 1060 KB Correct
4 Correct 10 ms 1056 KB Correct
5 Correct 10 ms 1052 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 4340 KB Correct
2 Correct 89 ms 6572 KB Correct
3 Correct 97 ms 7372 KB Correct
4 Correct 99 ms 7356 KB Correct
5 Correct 98 ms 7364 KB Correct
6 Correct 98 ms 7376 KB Correct
7 Correct 102 ms 7376 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4348 KB Correct
2 Correct 107 ms 6876 KB Correct
3 Correct 114 ms 7276 KB Correct
4 Correct 115 ms 7368 KB Correct
5 Correct 120 ms 7128 KB Correct
6 Correct 118 ms 7380 KB Correct
7 Correct 114 ms 7104 KB Correct
8 Correct 99 ms 7372 KB Correct