Submission #1125580

#TimeUsernameProblemLanguageResultExecution timeMemory
1125580LemserXoractive (IZhO19_xoractive)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using lld = long double;
using pii = pair<int,int>;
using pll = pair<ll, ll>;
 
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vlld = vector<lld>;
 
// #define endl '\n'
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define gcd(a,b) __gcd(a,b)
#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fls cout.flush()
 
#define fore(i,l,r) for(auto i=l;i<r;i++)
#define fo(i,n) fore(i,0,n)
#define forex(i,r,l) for(auto i=r; i>=l;i--)
#define ffo(i,n) forex(i,n-1,0)
 
bool cmin(ll &a, ll b) { if(b<a){a=b;return 1;}return 0; }
bool cmax(ll &a, ll b) { if(b>a){a=b;return 1;}return 0; }
void valid(ll in) { cout<<((in)?"YES\n":"NO\n"); }
ll lcm(ll a, ll b) { return (a/gcd(a,b))*b; }
ll gauss(ll n) { return (n*(n+1))/2; }


vector <int> ans;
map<ll, ll> tops;

vector<int> find (vector<int> &ids) {
	vector<int> R = ids;
	auto B = get_pairwise_xor(R);
	R.pb(1);
	auto A = get_pairwise_xor(R);
	multiset<ll> st;
	for (ll v: A) st.insert(v);
	for (ll v: B) st.erase(st.find(v));
	while (*st.begin() == 0) st.erase(st.find(0));
	vector<int> x;
	for (ll v: st) {
		ll r = (v^ans[0]);
		if (sz(x) && x.back() == r) continue;
		x.pb(r);
	}
	return x;
}

vector<int> guess(int n) {
	ans = vector<int>(n);
	ans[0] = ask(1);
	fo (b, 20) {
		if ((1<<b) > n-1) break;
		vll ids;
		fo (i, n) {
			if ((i&(1<<b)) == 0) continue;
			ids.pb(i);
		}
		vll A = find(ids);
		for (ll v: A) tops[v] += 1<<b;
	}
	for (auto [k, v]: tops) ans[v] = k;
	return ans;
}

// void test_case () {

// }

// int main() {
//     cin.tie(0)->sync_with_stdio(0);
//     int tt = 1;
//     // cin >> tt;
//     while (tt--) test_case();	
// }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:71:29: error: no matching function for call to 'find(vll&)'
   71 |                 vll A = find(ids);
      |                         ~~~~^~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Xoractive.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3876:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3876 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/11/bits/stl_algo.h:3876:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:71:29: note:   candidate expects 3 arguments, 1 provided
   71 |                 vll A = find(ids);
      |                         ~~~~^~~~~
In file included from /usr/include/c++/11/bits/locale_facets.h:48,
                 from /usr/include/c++/11/bits/basic_ios.h:37,
                 from /usr/include/c++/11/ios:44,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Xoractive.cpp:1:
/usr/include/c++/11/bits/streambuf_iterator.h:421:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >, const _CharT2&)'
  421 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/11/bits/streambuf_iterator.h:421:5: note:   template argument deduction/substitution failed:
Xoractive.cpp:71:29: note:   'std::vector<long long int>' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
   71 |                 vll A = find(ids);
      |                         ~~~~^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Xoractive.cpp:1:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
Xoractive.cpp:71:29: note:   candidate expects 4 arguments, 1 provided
   71 |                 vll A = find(ids);
      |                         ~~~~^~~~~
Xoractive.cpp:43:13: note: candidate: 'std::vector<int> find(std::vector<int>&)'
   43 | vector<int> find (vector<int> &ids) {
      |             ^~~~
Xoractive.cpp:43:32: note:   no known conversion for argument 1 from 'vll' {aka 'std::vector<long long int>'} to 'std::vector<int>&'
   43 | vector<int> find (vector<int> &ids) {
      |                   ~~~~~~~~~~~~~^~~