Submission #16523

#TimeUsernameProblemLanguageResultExecution timeMemory
16523eaststarFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include "friend.h" #include <algorithm> using namespace std; int a[100010],b[100010]; void findSample(int n,int *c,int *h,int *p){ int i; for(i=0;i<n;++i)a[i]=c[i]; for(;--i;){ if(!p[i]){ a[h[i]]+=b[i]; b[h[i]]+=max(a[i],b[i]); } else if(p[i]==1){ a[h[i]]=max(a[h[i]]+max(a[i],b[i]),b[h[i]]+a[i]); b[h[i]]+=b[i]; } else{ a[h[i]]=max(a[h[i]]+b[i],b[h[i]]+a[i]); b[h[i]]+=b[i]; } } return max(a[0],b[0]); }

Compilation message (stderr)

friend.cpp: In function ‘void findSample(int, int*, int*, int*)’:
friend.cpp:5:43: error: ambiguating new declaration of ‘void findSample(int, int*, int*, int*)’
 void findSample(int n,int *c,int *h,int *p){
                                           ^
In file included from friend.cpp:1:0:
friend.h:7:5: note: old declaration ‘int findSample(int, int*, int*, int*)’
 int findSample(int n,int confidence[],int host[],int protocol[]);
     ^
friend.cpp:22:25: error: return-statement with a value, in function returning 'void' [-fpermissive]
     return max(a[0],b[0]);
                         ^