답안 #149264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149264 2019-09-01T06:05:30 Z Little Piplup(#3742, gratus907, DHdroid, coffeetea99) King of Chairs (FXCUP4_chairs) C++17
95 / 100
436 ms 6256 KB
#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;
	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]);
		}
	}
	return maxweight;
}
#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();
	BB = B;
	Chairs = C;
	sort(Chairs.begin(),Chairs.end());
}

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;
	}
}

Compilation message

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();
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1044 KB Correct
2 Correct 10 ms 1044 KB Correct
3 Correct 10 ms 1044 KB Correct
4 Correct 11 ms 1040 KB Correct
5 Correct 10 ms 532 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 69 ms 3672 KB Correct
2 Correct 150 ms 5768 KB Correct
3 Correct 405 ms 6168 KB Correct
4 Correct 134 ms 6184 KB Correct
5 Correct 149 ms 6028 KB Correct
6 Correct 153 ms 6184 KB Correct
7 Correct 409 ms 6188 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 80 ms 3672 KB B = 993847
2 Partially correct 162 ms 5528 KB B = 996200
3 Partially correct 436 ms 6184 KB B = 706116
4 Partially correct 175 ms 6256 KB B = 998466
5 Partially correct 203 ms 6140 KB B = 995867
6 Partially correct 141 ms 6180 KB B = 997501
7 Partially correct 425 ms 6180 KB B = 706123
8 Correct 103 ms 6060 KB Correct