답안 #524495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524495 2022-02-09T10:03:04 Z Mr_Husanboy Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include "interactive.h"
#include<bits/stdc++.h>
using namespace std;

vector<int> guess(int n) {
	vector<int> ans;
	if(n<16){
		for(int i=1;i<=n;i++){
			ans.push_back(ask(i));
		}return ans;
	} int tem=ask(1);
	map<int,int> mp;
	for(int i=0;i<7;i++){
		vector<int> t;
		for(int j=1;j<n;j++){
			if(j>>i & 1) t.push_back(j+1);
		}
		vector<int> a=get_pairwise_xor(x);
		x.push_back(1);
		vector<int> b=get_pairwise_xor(x);
		map<int,int> m;
		for(auto u:a) m[u]--;
		for(auto u:b) m[u]++;
		for(auto u:m){
			if(m.second>0) mp[u.first^a]+=(1<<i);
		}
	}vector<int> ans2(n);
	for(auto u:mp) if(u.second<n) ans[u.second]=u.first;
	return ans2;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:18:34: error: 'x' was not declared in this scope
   18 |   vector<int> a=get_pairwise_xor(x);
      |                                  ^
Xoractive.cpp:25:9: error: 'class std::map<int, int>' has no member named 'second'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |         ^~~~~~
Xoractive.cpp:25:29: error: no match for 'operator^' (operand types are 'const int' and 'std::vector<int>')
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                      ~~~~~~~^~
      |                        |     |
      |                        |     std::vector<int>
      |                        const int
In file included from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/ios_base.h:91:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator^(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
   91 |   operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:91:46: note:   no known conversion for argument 2 from 'std::vector<int>' to 'std::_Ios_Fmtflags'
   91 |   operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
      |                                ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:133:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator^(std::_Ios_Openmode, std::_Ios_Openmode)'
  133 |   operator^(_Ios_Openmode __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:133:46: note:   no known conversion for argument 2 from 'std::vector<int>' to 'std::_Ios_Openmode'
  133 |   operator^(_Ios_Openmode __a, _Ios_Openmode __b)
      |                                ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:173:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator^(std::_Ios_Iostate, std::_Ios_Iostate)'
  173 |   operator^(_Ios_Iostate __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:173:44: note:   no known conversion for argument 2 from 'std::vector<int>' to 'std::_Ios_Iostate'
  173 |   operator^(_Ios_Iostate __a, _Ios_Iostate __b)
      |                               ~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bitset:1453:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator^(const std::bitset<_Nb>&, const std::bitset<_Nb>&)'
 1453 |     operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
      |     ^~~~~~~~
/usr/include/c++/10/bitset:1453:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::bitset<_Nb>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:410:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_xor, typename _Dom1::value_type>::result_type> std::operator^(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
  410 |     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:410:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:410:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_xor, typename _Dom1::value_type>::result_type> std::operator^(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  410 |     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:410:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:410:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_xor, typename _Dom1::value_type>::result_type> std::operator^(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  410 |     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:410:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:410:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_xor, typename _Dom1::value_type>::result_type> std::operator^(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
  410 |     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:410:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:410:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_xor, typename _Dom1::value_type>::result_type> std::operator^(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  410 |     _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:410:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/valarray:1190:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_xor, _Tp>::result_type> std::operator^(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
 1190 | _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1190:1: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::valarray<_Tp>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/valarray:1190:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_xor, _Tp>::result_type> std::operator^(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
 1190 | _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1190:1: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   mismatched types 'const std::valarray<_Tp>' and 'const int'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Xoractive.cpp:2:
/usr/include/c++/10/valarray:1190:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_xor, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_xor, _Tp>::result_type> std::operator^(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
 1190 | _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1190:1: note:   template argument deduction/substitution failed:
Xoractive.cpp:25:30: note:   'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
   25 |    if(m.second>0) mp[u.first^a]+=(1<<i);
      |                              ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from Xoractive.cpp:2:
/usr/include/c++/10/future:155:20: note: candidate: 'constexpr std::launch std::operator^(std::launch, std::launch)'
  155 |   constexpr launch operator^(launch __x, launch __y)
      |                    ^~~~~~~~
/usr/include/c++/10/future:155:37: note:   no known conversion for argument 1 from 'const int' to 'std::launch'
  155 |   constexpr launch operator^(launch __x, launch __y)
      |                              ~~~~~~~^~~
Xoractive.cpp:11:8: warning: unused variable 'tem' [-Wunused-variable]
   11 |  } int tem=ask(1);
      |        ^~~