답안 #96408

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96408 2019-02-09T10:31:00 Z MvC 도서관 (JOI18_library) C++11
컴파일 오류
0 ms 0 KB
#pragma GCC optimize("O3")
#incldue "library.h"
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,viz[1050];
int get(int r)
{
	vector<int>v;
	for(int i=1;i<=n;i++)if(!viz[i])v.pb(i);
	while(v.size()!=1)
	{
		vector<int>l,r,s(n,0);
		int mid=(int)v.size()/2;
		for(int i=0;i<mid;i++)l.pb(v[i]),s[v[i]-1]=1;
		for(int i=mid;i<v.size();i++)r.pb(v[i]);
		int x=Query(s);
		s[r]=1;
		if(Query(s)==x)v=l;
		else v=r;
	}
	return v[0];
}
void Solve(int N)
{
	n=N;
	int r;
	for(int i=1;i<=n;i++)
	{
		vector<int>v;
		for(int j=1;j<=n;j++)
		{
			if(i==j)v.pb(0);
			else v.pb(1);
		}
		if(Query(v)==1)r=i;
	}
	vector<int>ans;
	ans.pb(r);
	viz[r]=1;
	for(int i=2;i<=n;i++)
	{
		int nxt=get(r);
		ans.pb(nxt);
		r=nxt;
		viz[r]=1;
	}
	Answer(ans);
}
/*int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	
    return 0;
}*/

Compilation message

library.cpp:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
 #incldue "library.h"
  ^~~~~~~
  include
library.cpp: In function 'int get(int)':
library.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=mid;i<v.size();i++)r.pb(v[i]);
                 ~^~~~~~~~~
library.cpp:30:9: error: 'Query' was not declared in this scope
   int x=Query(s);
         ^~~~~
library.cpp:31:4: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::vector<int>')
   s[r]=1;
    ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from library.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:795:7: note: candidate: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]
       operator[](size_type __n) _GLIBCXX_NOEXCEPT
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:795:7: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type {aka long unsigned int}'
/usr/include/c++/7/bits/stl_vector.h:813:7: note: candidate: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]
       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:813:7: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type {aka long unsigned int}'
library.cpp: In function 'void Solve(int)':
library.cpp:49:6: error: 'Query' was not declared in this scope
   if(Query(v)==1)r=i;
      ^~~~~
library.cpp:61:2: error: 'Answer' was not declared in this scope
  Answer(ans);
  ^~~~~~