Submission #713838

#TimeUsernameProblemLanguageResultExecution timeMemory
713838PacybwoahXoractive (IZhO19_xoractive)C++14
Compilation error
0 ms0 KiB
#include "interactive.h" #include<vector> #include<map> #include<algorithm> using namespace std; vector<int> guess(int n) { vector <int> ans(n); int one=ask(1); vector<vector<int>> bitxor(7),askans(7),noone(7); for(int i=1;i<=n;i++){ for(int j=0;j<7;j++){ if(i&(i<<j)) bitxor[j].push_back(i); } } for(int i=0;i<7;i++){ askans[i]=get_pairwise_xor(bitxor[i]); bitxor[i].erase(bitxor.begin()); noone[i]=get_pairwise_xor(bitxor[i]); for(int j=0;j<noone[i].size();j++){ askans[i].erase(find(askans[i].begin(),askans[i].end(),noone[i][j])); } while(*askans[i].begin()==0) askans[i].erase(askans[i].begin()); } map<int,int> m; for(int i=0;i<7;i++){ for(int j=0;j<askans[i].size();j++){ askans[i][j]^=one; m[askans[i][j]]+=(1<<i); } } ans[0]=one; for(auto x:m){ ans[x.second-1]=x.first; } return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:18:39: error: no matching function for call to 'std::vector<int>::erase(std::vector<std::vector<int> >::iterator)'
   18 |         bitxor[i].erase(bitxor.begin());
      |                                       ^
In file included from /usr/include/c++/10/vector:67,
                 from interactive.h:5,
                 from Xoractive.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1430:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = std::vector<int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<int>::const_iterator]'
 1430 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/10/bits/stl_vector.h:1430:28: note:   no known conversion for argument 1 from '__normal_iterator<std::vector<int>*,vector<std::vector<int>>>' to '__normal_iterator<const int*,vector<int>>'
 1430 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1457:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = std::vector<int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<int>::const_iterator]'
 1457 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/10/bits/stl_vector.h:1457:7: note:   candidate expects 2 arguments, 1 provided
Xoractive.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int j=0;j<noone[i].size();j++){
      |                     ~^~~~~~~~~~~~~~~~
Xoractive.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=0;j<askans[i].size();j++){
      |                     ~^~~~~~~~~~~~~~~~~