제출 #149346

#제출 시각아이디문제언어결과실행 시간메모리
149346Little Piplup (#200)King of Chairs (FXCUP4_chairs)C++17
55 / 100
542 ms6192 KiB
#include "king.h"
#include <bits/stdc++.h>
long long SendInfo(std::vector<int> W, std::vector<int> C) 
{
	int N = W.size();
	sort(C.begin(),C.end());
	sort(W.begin(),W.end());
	std::vector <bool> able(N, false);
	std::vector <bool> FC(N, false);
	long long maxweight = 0;
	long long maxchair = -1;
	for (int i = 0; i<N; i++)
	{
		int u = std::lower_bound(C.begin(),C.end(),W[i])-C.begin();
		while(u < N && FC[u])
		{
			u++;
		}
		if (u == N)
		{
			continue;
		}
		else 
		{
			FC[u] = 1;
			maxweight = std::max(maxweight,(long long)W[i]);
			maxchair = std::max(maxchair, (long long)u);
		}
	}
	return maxchair;
}
#include "vassal.h"
#include <algorithm>
long long BB;
std::vector <int> Chairs;
bool fullchair[101010];
void Init(long long B, std::vector<int> C)
{
	int N = C.size();
	Chairs = C;
	sort(Chairs.begin(),Chairs.end());
	BB = Chairs[B];
}

int Maid(int W)
{
	if (W > BB)
		return -1;
	int N = Chairs.size();
	int u = std::lower_bound(Chairs.begin(),Chairs.end(),W)-Chairs.begin();
	while(u < N && fullchair[u])
	{
		u++;
	}
	if (u == N)
	{
		return -1;
	}
	else 
	{
		fullchair[u] = 1;
		return u;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:8:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...