Submission #149263

# Submission time Handle Problem Language Result Execution time Memory
149263 2019-09-01T06:05:24 Z 욱방켜!! (twitch.tv/wookje)(#3584, kig9981, cheetose, jh05013) King of Chairs (FXCUP4_chairs) C++17
Compilation error
0 ms 0 KB
long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	std::multiset<int> CC(C.begin(),C.end());
	std::sort(W.begin(),W.end());
	std::sort(C.begin(),C.end());
	long long t=0;
	std::vector<int> v;
	for(int i=0;i<N;i++) {
		auto it=CC.lower_bound(W[i]);
		if(it!=CC.end())
		{
			v.push_back(*it);
			t++;
			CC.erase(it);
		}
	}
	while(t>1 && v.back()==v[t-2])
	{
		t--;
		v.pop_back();
	}
	return t;
}
#include <bits/stdc++.h>

long long BB;
int N;
std::set<std::pair<int,int>> S;
std::vector<int> CC;

void Init(long long B, std::vector<int> C){
	N = C.size();
	BB = B;
	CC=C;
	std::sort(CC.begin(),CC.end());
	for(int i=0;i<N;i++) S.insert({C[i],i});
}

int Maid(int W){
	int ret;
	auto it=S.lower_bound(std::make_pair(W,-1));
	if(BB<N && W>CC[BB] || it==S.end()) return -1;
	ret=it->second;
	S.erase(it);
	return ret;
}

Compilation message

king.cpp:1:25: error: 'vector' is not a member of 'std'
 long long SendInfo(std::vector<int> W, std::vector<int> C) {
                         ^~~~~~
king.cpp:1:32: error: expected primary-expression before 'int'
 long long SendInfo(std::vector<int> W, std::vector<int> C) {
                                ^~~
king.cpp:1:45: error: 'vector' is not a member of 'std'
 long long SendInfo(std::vector<int> W, std::vector<int> C) {
                                             ^~~~~~
king.cpp:1:52: error: expected primary-expression before 'int'
 long long SendInfo(std::vector<int> W, std::vector<int> C) {
                                                    ^~~
king.cpp:1:58: error: expression list treated as compound expression in initializer [-fpermissive]
 long long SendInfo(std::vector<int> W, std::vector<int> C) {
                                                          ^

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:19:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(BB<N && W>CC[BB] || it==S.end()) return -1;