Submission #285362

#TimeUsernameProblemLanguageResultExecution timeMemory
285362YJULibrary (JOI18_library)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"library.h" #pragma GCC optimize("unroll-loops,no-stack-protector") using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,ll> pll; const ll MOD=1e9+7; const ll MOD2=998244353; const ld pi=3.14159265359; const ll INF=(1LL<<60); #define SQ(i) ((i)*(i)) #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define setp setprecision #define lwb lower_bound #define SZ(_a) (ll)_a.size() void Solve(int N){ vector<ll> q(N),t(N),ans; ll A,B; REP(i,N)t[i]=i,q[i]=1; REP(i,N){ q[i]=0; if(Query(q)==1){ t.erase(t.begin()+i); ans.pb(i);break; } q[i]=1; } REP(i,N)q[i]=0; while(SZ(ans)<N){ ll l=-1,r=SZ(t)-1; while(r-1>l){ ll mid=(l+r)/2; REP(i,mid)q[t[i]]=1; A=Query(q); q[ans.back()]=1; B=Query(q); REP(i,mid)q[t[i]]=0; q[ans.back()]=0; if(A==B){ r=mid; }else{ l=mid; } } ans.pb(t[r]); t.erase(t.begin()+r); } REP(i,N)ans[i]+1; Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:29:12: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   29 |   if(Query(q)==1){
      |            ^
In file included from library.cpp:2:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:41:12: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   41 |    A=Query(q);
      |            ^
In file included from library.cpp:2:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:43:12: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   43 |    B=Query(q);
      |            ^
In file included from library.cpp:2:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:55:16: warning: value computed is not used [-Wunused-value]
   55 |  REP(i,N)ans[i]+1;
library.cpp:56:9: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   56 |  Answer(ans);
      |         ^~~
In file included from library.cpp:2:
library.h:3:37: note: in passing argument 1 of 'void Answer(const std::vector<int>&)'
    3 | void Answer(const std::vector<int>& res);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~