제출 #169174

#제출 시각아이디문제언어결과실행 시간메모리
169174RafaelSusXoractive (IZhO19_xoractive)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; const int N = 5e5 + 5; typedef long long ll; #define pb push_back vector<int>guess(int n){ int res[n],p=0; if(n<=4){ for(int i=0;i<n;i++) res[i]=ask(i+1); vector<int>answ; for(int i=0;i<n;i++)answ.push_back(res[i]); return answ; } res[0]=ask(1); vector<int>idx[7][3]; for(int i=2;i<=n;i++){ for(int j=0;j<=6;j++){ idx[j][(i>>j)%2].push_back(i); } } vector<int>a[7]; set<int>all; set<int>h[7][2]; for(int i=0;i<=6;i++){ vector<int>v1=get_pairwise_xor(idx[i][1]); idx[i][1].push_back(1); vector<int>v2=get_pairwise_xor(idx[i][1]); idx[i][1].pop_back(); multiset<int>fi,se; for(int i=0;i<(int)v1.size();i++)fi.insert(v1[i]); for(int i=0;i<(int)v2.size();i++)se.insert(v2[i]); for(auto x:fi) se.erase(se.find(x)); vector<int>tmp; for(auto x:se) tmp.insert(x^res[0]); tmp.erase(res[0]); for(auto x:tmp) all.insert(x); h[i][1]=tmp; } for(int i=0;i<=6;i++){ h[i][0]=all; for(auto x:h[i][1]) h[i][0].erase(x); } for(int i=2;i<=n;i++){ set<int>tmp=all; for(int j=0;j<=6;j++){ for(auto x:all){ if(h[j][(i>>j)%2].find(x)==h[j][(i>>j)%2].end()) tmp.erase(x); } } res[i-1]=*tmp.begin(); }vector<int>answ; for(int i=0;i<n;i++)answ.push_back(res[i]); return answ; }

컴파일 시 표준 에러 (stderr) 메시지

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:40:26: error: no matching function for call to 'std::vector<int>::insert(int)'
       tmp.insert(x^res[0]);
                          ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from Xoractive.cpp:1:
/usr/include/c++/7/bits/vector.tcc:114:5: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::value_type = int]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:114:5: note:   candidate expects 2 arguments, 1 provided
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 Xoractive.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:1042:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::value_type = int]
       insert(const_iterator __position, value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1042:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1059:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*]
       insert(const_iterator __position, initializer_list<value_type> __l)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1059:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1084:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int]
       insert(const_iterator __position, size_type __n, const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1084:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1128:2: note: candidate: template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]
  insert(const_iterator __position, _InputIterator __first,
  ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1128:2: note:   template argument deduction/substitution failed:
Xoractive.cpp:40:26: note:   candidate expects 3 arguments, 1 provided
       tmp.insert(x^res[0]);
                          ^
Xoractive.cpp:41:21: error: no matching function for call to 'std::vector<int>::erase(int&)'
     tmp.erase(res[0]);
                     ^
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 Xoractive.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:1179: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 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*]
       erase(const_iterator __position)
       ^~~~~
/usr/include/c++/7/bits/stl_vector.h:1179:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator {aka __gnu_cxx::__normal_iterator<const int*, std::vector<int> >}'
/usr/include/c++/7/bits/stl_vector.h:1206: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 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*]
       erase(const_iterator __first, const_iterator __last)
       ^~~~~
/usr/include/c++/7/bits/stl_vector.h:1206:7: note:   candidate expects 2 arguments, 1 provided
Xoractive.cpp:44:13: error: no match for 'operator=' (operand types are 'std::set<int>' and 'std::vector<int>')
     h[i][1]=tmp;
             ^~~
In file included from /usr/include/c++/7/set:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from Xoractive.cpp:1:
/usr/include/c++/7/bits/stl_set.h:288:7: note: candidate: std::set<_Key, _Compare, _Alloc>& std::set<_Key, _Compare, _Alloc>::operator=(const std::set<_Key, _Compare, _Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]
       operator=(const set&) = default;
       ^~~~~~~~
/usr/include/c++/7/bits/stl_set.h:288:7: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::set<int>&'
/usr/include/c++/7/bits/stl_set.h:292:7: note: candidate: std::set<_Key, _Compare, _Alloc>& std::set<_Key, _Compare, _Alloc>::operator=(std::set<_Key, _Compare, _Alloc>&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]
       operator=(set&&) = default;
       ^~~~~~~~
/usr/include/c++/7/bits/stl_set.h:292:7: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::set<int>&&'
/usr/include/c++/7/bits/stl_set.h:306:7: note: candidate: std::set<_Key, _Compare, _Alloc>& std::set<_Key, _Compare, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_set.h:306:7: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<int>'
Xoractive.cpp:10:14: warning: unused variable 'p' [-Wunused-variable]
   int res[n],p=0;
              ^