Submission #96409

#TimeUsernameProblemLanguageResultExecution timeMemory
96409MvC도서관 (JOI18_library)C++11
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #include "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 (stderr)

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: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 library.h:1,
                 from library.cpp:2:
/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}'