답안 #590012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590012 2022-07-05T13:07:56 Z drkarlicio2107 Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std; vector <int> L; vector <int> ans;
/*int publish ( vector <int> R){
	for (int i=0; i<R.size(); i++) cout << R [i] << " ";
	cout << endl;
	int re; cin >> re;
	return re;
}
void answer ( vector <int> R){
	for (int i=0; i<R.size(); i++) cout << R [i] << " ";
	cout << endl;
	return ;
}*/
int pos [5000];
void solve (int N){
	int last=-1;
	for (int i=1; i<N+1; i++){
		L.clear ();
		for (int j=1; j<i; j++) L.push_back (j);
		for (int j=i; j<N+1; j++) L.push_back (j);
		int ans=publish (L);
		if (last==-1){
			last=ans; continue;
		}
		pos [(n-ans+last)/2]=N-i+2;
	}
	for (int i=0; i<N; i++){
		if (pos [i]==0) ans.push_back (1);
		else ans.push_back (pos [i]);
	}
	answer (ans);
	return ;
}
/*int main (){
	int n; cin >> n;
	solve (n);
	return 0;
}*/

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:21:11: error: 'publish' was not declared in this scope
   21 |   int ans=publish (L);
      |           ^~~~~~~
art.cpp:25:9: error: 'n' was not declared in this scope
   25 |   pos [(n-ans+last)/2]=N-i+2;
      |         ^
art.cpp:31:2: error: 'answer' was not declared in this scope
   31 |  answer (ans);
      |  ^~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~