Submission #138305

#TimeUsernameProblemLanguageResultExecution timeMemory
138305NucleistFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> 
#include "friend.h"
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
ll weight[11];
bool visited[11];
vector<ll>adj[11];
ll dal;
ll solve(ll node)
{
	if(node>dal)return 0;
	ll ans = 0;
	if(!visited[node])
	{
		visited[node]=1;
		for (ll i = 0; i < adj[node].size(); ++i)
		{
			ll next = adj[node][i];
			visited[next]=1;
		}
		ans=max(ans,solve(node+1)+weight[node]);
		for (ll i = 0; i < adj[node].size(); ++i)
		{
			ll next = adj[node][i];
			visited[next]=0;
		}
		visited[node]=0;
	}
	ans = max(ans,solve(node+1));
	return ans;
}
ll findSample(ll n,ll confidence[],ll host[],ll protocol[])
{
	dal = n;
	for (ll i = 0; i <= n; ++i)
	{
		weight[i]=confidence[i];
	}
  for (ll i = 1; i <= dal; ++i)
  {
  	ll now = host[i];
  	ll prot = protocol[i];
  	ll newi = i;
  	if(prot==0 || prot==2)
  	{
  		adj[now].pb(newi);
  		adj[newi].pb(now);
  	}
  	if(prot==1 || prot==2)
  	{
  		for (ll j = 0; j < adj[now].size(); ++j)
  		{
  			ll neigh = adj[now][i];
  			adj[neigh].pb(newi);
  			adj[newi].pb(neigh);
  		}
  	}
  }
  return solve(0);
}
//code the AC sol !
// BS/queue/map

Compilation message (stderr)

friend.cpp: In function 'long long int solve(long long int)':
friend.cpp:28:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ll i = 0; i < adj[node].size(); ++i)
                  ~~^~~~~~~~~~~~~~~~~~
friend.cpp:34:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ll i = 0; i < adj[node].size(); ++i)
                  ~~^~~~~~~~~~~~~~~~~~
friend.cpp: In function 'long long int findSample(long long int, long long int*, long long int*, long long int*)':
friend.cpp:63:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ll j = 0; j < adj[now].size(); ++j)
                    ~~^~~~~~~~~~~~~~~~~
/tmp/ccx1uwDH.o: In function `main':
grader.cpp:(.text.startup+0xba): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status