제출 #16525

#제출 시각아이디문제언어결과실행 시간메모리
16525eaststar친구 (IOI14_friend)C++14
컴파일 에러
0 ms0 KiB
#include "friend.h"
#include <algorithm>
using namespace std;
int findSample(int n,int *c,int *h,int *p,int *b){
    int i;
    for(;--i;){
        if(!p[i]){
            c[h[i]]+=b[i];
            b[h[i]]+=max(c[i],b[i]);
        }
        else if(p[i]==1){
            c[h[i]]=max(c[h[i]]+max(c[i],b[i]),b[h[i]]+c[i]);
            b[h[i]]+=b[i];
        }
        else{
            c[h[i]]=max(c[h[i]]+b[i],b[h[i]]+c[i]);
            b[h[i]]+=b[i];
        }
    }
    return max(c[0],b[0]);
}

컴파일 시 표준 에러 (stderr) 메시지

friend.cpp: In function ‘int findSample(int, int*, int*, int*, int*)’:
friend.cpp:5:9: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
     int i;
         ^
/tmp/ccAGRFoB.o: In function `main':
grader.cpp:(.text.startup+0xb4): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status