답안 #153139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153139 2019-09-12T15:15:11 Z phpark King of Chairs (FXCUP4_chairs) C++17
컴파일 오류
0 ms 0 KB
#inlcude <iostream>
#include "king.h"
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int SendInfo(vector <int> W, vector <int> C)
{
	return 1;
}
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include "vassal.h"
using namespace std;
set <int> sit;
void Init(int B, vector <int> C)
{
	sort(C.begin(), C.end());
	for (int i = 0; i < N; i++) sit.insert(i);
}

int Maid(int w)
{
	int right = 0, left = 0, mid = 0, res = 0;
	while (right <= left) {
		mid = (right + left) / 2;
		if (C[mid] > w) {
			right = mid - 1;
			if (right <= left) {
				res = mid;
				break;
			}
		}
		else if (C[mid] < w) {
			left = mid + 1;
			if (right <= left) {
				res = right;
				break;
			}
		}
		else {
			res = mid;
			break;
		}
	}
	
	auto itr = sit.upper_bound(res);
	if (itr == sit.end()) {
		return -1;
	}
	else {
		int answer = *itr;
		sit.erase(itr);
			
		return answer;
	}
}

Compilation message

king.cpp:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
 #inlcude <iostream>
  ^~~~~~~
  include
king.cpp: In function 'int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:7:5: error: ambiguating new declaration of 'int SendInfo(std::vector<int>, std::vector<int>)'
 int SendInfo(vector <int> W, vector <int> C)
     ^~~~~~~~
In file included from king.cpp:2:0:
king.h:3:11: note: old declaration 'long long int SendInfo(std::vector<int>, std::vector<int>)'
 long long SendInfo(std::vector<int> W, std::vector<int> C);
           ^~~~~~~~

vassal.cpp: In function 'void Init(int, std::vector<int>)':
vassal.cpp:11:22: error: 'N' was not declared in this scope
  for (int i = 0; i < N; i++) sit.insert(i);
                      ^
vassal.cpp: In function 'int Maid(int)':
vassal.cpp:19:7: error: 'C' was not declared in this scope
   if (C[mid] > w) {
       ^