답안 #148601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148601 2019-09-01T04:45:15 Z 욱방켜!! (twitch.tv/wookje)(#3584, kig9981, cheetose, jh05013) King of Chairs (FXCUP4_chairs) C++17
컴파일 오류
0 ms 0 KB
#include "king.h"
#include <bits/stdc++.h>

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());
	for(int i=0;i<N;i++) {
		auto it=CC.lower_bound(W[i]);
		if(it==CC.end()) return W[i]-1;
		CC.erase(it);
	}
	return W[N-1];
}
#include "vassal.h"
#include <bits/stdc++.h>

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

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

int Maid(int W){
	int ret;
	if(W>BB) return -1;
	auto it=S.lower_bound(make_pair(W,-1));
	ret=it->second;
	S.erase(it);
	return ret;
}

Compilation message

vassal.cpp:5:10: error: 'pair' was not declared in this scope
 std::set<pair<int,int>> S;
          ^~~~
vassal.cpp:5:10: note: suggested alternative:
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/vector:60,
                 from vassal.h:2,
                 from vassal.cpp:1:
/usr/include/c++/7/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
vassal.cpp:5:22: error: template argument 1 is invalid
 std::set<pair<int,int>> S;
                      ^~
vassal.cpp:5:22: error: template argument 2 is invalid
vassal.cpp:5:22: error: template argument 3 is invalid
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:10:25: error: request for member 'insert' in 'S', which is of non-class type 'int'
  for(int i=0;i<N;i++) S.insert({C[i],i});
                         ^~~~~~
vassal.cpp: In function 'int Maid(int)':
vassal.cpp:16:12: error: request for member 'lower_bound' in 'S', which is of non-class type 'int'
  auto it=S.lower_bound(make_pair(W,-1));
            ^~~~~~~~~~~
vassal.cpp:16:24: error: 'make_pair' was not declared in this scope
  auto it=S.lower_bound(make_pair(W,-1));
                        ^~~~~~~~~
vassal.cpp:16:24: note: suggested alternative:
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/vector:60,
                 from vassal.h:2,
                 from vassal.cpp:1:
/usr/include/c++/7/bits/stl_pair.h:519:5: note:   'std::make_pair'
     make_pair(_T1&& __x, _T2&& __y)
     ^~~~~~~~~
vassal.cpp:18:4: error: request for member 'erase' in 'S', which is of non-class type 'int'
  S.erase(it);
    ^~~~~