제출 #16523

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
165232015-08-27 03:22:49eaststar친구 (IOI14_friend)C++14
컴파일 에러
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]);
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (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]);
                         ^