제출 #7581

#제출 시각아이디문제언어결과실행 시간메모리
7581jihoon친구 (IOI14_friend)C++98
컴파일 에러
0 ms0 KiB
#include<cstdio> #include<algorithm> using namespace std; int n; int confi[100001]; int host[100001]; int protocol[100001]; int dp[100001][2]; int main(){ int i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&confi[i]); dp[i][0]=confi[i]; } for(i=1;i<n;i++){ scanf("%d",&host[i]); scanf("%d",&protocol[i]); } for(i=n-1;i>=1;i--){ if(protocol[i]==0){ dp[host[i]][0]+=dp[i][1]; dp[host[i]][1]=max(dp[host[i]][1]+dp[i][1],dp[host[i]][1]+dp[i][0]); }else if(protocol[i]==1){ dp[host[i]][0]=max(dp[host[i]][0]+dp[i][0],max(dp[host[i]][0]+dp[i][1],dp[host[i]][1]+dp[i][0])); dp[host[i]][1]+=dp[i][1]; }else{ dp[host[i]][0]=max(dp[host[i]][0]+dp[i][1],dp[host[i]][1]+dp[i][0]); dp[host[i]][1]+=dp[i][1]; } } printf("%d",max(dp[0][0],dp[0][1])); }

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

friend.cpp: In function 'int main()':
friend.cpp:12:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
friend.cpp:14:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
friend.cpp:18:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
friend.cpp:19:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
/tmp/ccr1kW58.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccRaVZZb.o:friend.cpp:(.text.startup+0x0): first defined here
/tmp/ccr1kW58.o:(.bss+0x0): multiple definition of `protocol'
/tmp/ccRaVZZb.o:(.bss+0xc3520): first defined here
/usr/bin/ld: Warning: size of symbol `protocol' changed from 400004 in /tmp/ccRaVZZb.o to 400008 in /tmp/ccr1kW58.o
/tmp/ccr1kW58.o:(.bss+0x61aa0): multiple definition of `host'
/tmp/ccRaVZZb.o:(.bss+0x124fc0): first defined here
/usr/bin/ld: Warning: size of symbol `host' changed from 400004 in /tmp/ccRaVZZb.o to 400008 in /tmp/ccr1kW58.o
/tmp/ccr1kW58.o: In function `main':
grader.cpp:(.text.startup+0xa9): undefined reference to `findSample(int, int*, int*, int*)'
collect2: ld returned 1 exit status