Submission #370677

# Submission time Handle Problem Language Result Execution time Memory
370677 2021-02-24T13:21:36 Z fhvirus Xoractive (IZhO19_xoractive) C++17
Compilation error
0 ms 0 KB
// Knapsack DP is harder than FFT.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb emplace_back
#define FOR(i,n) for(int i = 0; i < (n); ++i)
#define FOO(i,a,b) for(int i = (a); i <= (b); ++i)
#define AI(x) (x).begin(),(x).end()
template<typename I> bool chmax(I &a, I b){ return a < b ? (a = b, true) : false;}
template<typename I> bool chmin(I &a, I b){ return a > b ? (a = b, true) : false;}
#ifdef OWO
#define debug(args...) LKJ("[ " + string(#args) + " ]", args)
void LKJ(){ cerr << endl;}
template<typename I, typename...T> void LKJ(I&&x, T&&...t){ cerr<<x<<", ", LKJ(t...);}
template<typename I> void DE(I a, I b){ while(a < b) cerr<<*a<<" \n"[next(a)==b], ++a;}
#else
#define debug(...) 0
#define DE(...) 0
#endif
#include "interactive.h"
using namespace std;
vector<int> guess(int n) {
	int k = __lg(n) + 1;
	vector<int> ans;
	vector<vector<int>> ss(k, vector<int>());
	ans.pb(ask(1));
	FOR(j,k){
		vector<int> q;
		FOR(i,n) if(i>>j&1) q.pb(i+1);
		vector<int> r = get_pairwise_xor(q);
		
		q.pb(1);
		ss[j] = get_pairwise_xor(q);
		ss[j].erase(ss[j].begin()); // a[0] ^ a[0]
		for(int x: r) ss[j].erase(find(AI(ss[j]), x));
		for(int &i: ss[j]) i ^= ans[0];
	}
	FOO(i,1,n-1){
		vector<int> v;
		FOR(j,k){
			if((i>>j&1)^1) continue;
			if(v.empty()) v = ss[j];
			else{
				vector<int> w;
				for(int x: ss[j])
					if(find(AI(v), x) != v.end())
						w.pb(x);
				v.swap(w);
			}
		}
		FOR(j,k){
			if(i>>j&1) continue;
			for(int x: ss[j]){
				auto it = v.find(AI(v), x);
				if(it != v.end()) v.erase(it);
			}
		}
		ans.pb(v[0]);
	}
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:57:17: error: 'class std::vector<int>' has no member named 'find'
   57 |     auto it = v.find(AI(v), x);
      |                 ^~~~