Submission #413714

#TimeUsernameProblemLanguageResultExecution timeMemory
413714AntekbFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include "friend.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// Find out best sample
ll findSample(int n,int confidence[],int host[],int protocol[]){
	ll ans=0;
	vector<ll> w(n);
	for(int i=0; i<n; i++){
		w[i]=confidence[i];
	}
	for(int i=n-1; i>0; i--){
		if(protocol[i]==0){
			w[host[i]]-=w[i];
			ans+=w[i];
		}
		else if(protocol[i]==1){
			w[host[i]]=max(w[host[i]], w[host[i]]+w[i]);
		}
		else{
			w[host[i]]=max(w[host[i]], w[i]);
		}
	}
	ans+=max(0ll, w[0]);
	return ans;
}

Compilation message (stderr)

friend.cpp:6:4: error: ambiguating new declaration of 'll findSample(int, int*, int*, int*)'
    6 | ll findSample(int n,int confidence[],int host[],int protocol[]){
      |    ^~~~~~~~~~
In file included from friend.cpp:1:
friend.h:7:5: note: old declaration 'int findSample(int, int*, int*, int*)'
    7 | int findSample(int n,int confidence[],int host[],int protocol[]);
      |     ^~~~~~~~~~