제출 #702070

#제출 시각아이디문제언어결과실행 시간메모리
702070PCTprobability친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //#include "friend.h" using namespace std; using ll = long long; #define pb push_back vector<int> g[100000]; int dp[100000][2]; ll con[100000]; void dfs(int a,int b){ for(auto e:g[a]){ if(e==b) continue; dfs(e,a); dp[a][0]+=max(dp[e][0],dp[e][1]); dp[a][1]+=dp[e][0]; } dp[a][1]+=con[a]; dp[a][1]=max(dp[a][1],dp[a][0]); } int findSample(int n, vector<int> confidence, vector<int> host, vector<int> protocol){ for(int i=0;i<n;i++) con[i]=confidence[i]; for(int i=n-1;i>=1;i--){ assert(host[i]<i); dp[i][1]+=con[i]; dp[i][1]=max(dp[i][1],dp[i][0]); if(protocol[i]==0){ dp[host[i]][0]+=dp[i][1]; dp[host[i]][1]+=dp[i][0]; } if(protocol[i]==1){ dp[host[i]][0]+=dp[i][0]; dp[host[i]][1]+=dp[i][1]; } if(protocol[i]==2){ } } dp[0][1]+=con[0]; return max(dp[0][1],dp[0][0]); } int main(){ int n; cin>>n; vector<int> confidence(n); for(int i=0;i<n;i++) cin>>confidence[i]; vector<int> host(n),protocol(n); for(int i=0;i<n;i++) cin>>host[i]>>protocol[i]; cout<<findSample(6,{10,1,1,1,50,100},{0,0,0,0,0,0},{0,1,1,1,1,1})<<endl; }

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

/usr/bin/ld: /tmp/ccx13w6o.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWekfXq.o:friend.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccx13w6o.o: in function `main':
grader.cpp:(.text.startup+0xdd): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status