#include "friend.h"
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=99824LL;
template<class A=ll>
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
ll f(ll bin,vector<vector<ll> > adj, ll N,vector<ll> c)
{
vector<bool> in;
REP(i,0,N) {in.pb((bin&(1LL<<i))>0);}
REP(i,0,N)
{
REP(j,i+1,N)
{
if(in[i]&&in[j]&&(find(whole(adj[i]),j)!=adj[i].end())) {return 0;}
}
}
ll ans=0LL; REP(i,0,N) {if(in[i]) {ans+=c[i];}}
return ans;
}
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[])
{
ll N = (ll) n; vector<ll> c,h,p; REP(i,0,N) {c.pb((ll) confidence[i]); h.pb((ll) host[i]); p.pb((ll) protocol[i]);}
if(N<=10LL)
{
vector<ll> xx; vector<vector<ll> > adj; REP(i,0,N) {adj.pb(xx);}
REP(i,1,N)
{
if(p[i]==0) {adj[i].pb(h[i]); adj[h[i]].pb(i);}
else if(p[i]==1)
{
REP(j,0,adj[h[i]].size()) {ll nei = adj[h[i]][j]; adj[i].pb(nei); adj[nei].pb(i);}
}
else
{
REP(j,0,adj[h[i]].size()) {ll nei = adj[h[i]][j]; adj[i].pb(nei); adj[nei].pb(i);}
adj[i].pb(h[i]); adj[h[i]].pb(i);
}
}
ll ans=0LL;
REP(i,0,(1LL<<N)) {ans=max(ans,f(i,adj,N,c));}
}
return ans;
}
Compilation message
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:76:12: error: 'ans' was not declared in this scope
return ans;
^~~
friend.cpp:76:12: note: suggested alternative: 'abs'
return ans;
^~~
abs