제출 #312062

#제출 시각아이디문제언어결과실행 시간메모리
312062vipghn2003친구 (IOI14_friend)C++14
100 / 100
35 ms4216 KiB
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; long long f[N][2]; int findSample(int n,int confidence[],int host[],int protocol[]) { for(int i=0;i<n;i++) { f[i][1]=confidence[i]; f[i][0]=0; } for(int i=n-1;i>0;i--) { if(!protocol[i]) { f[host[i]][1]+=f[i][0]; f[host[i]][0]+=max(f[i][0],f[i][1]); } else if(protocol[i]==1) { f[host[i]][1]=max({f[host[i]][1]+f[i][0],f[i][1]+f[host[i]][0],f[host[i]][1]+f[i][1]}); f[host[i]][0]+=f[i][0]; } else { f[host[i]][1]=max(f[host[i]][1]+f[i][0],f[i][1]+f[host[i]][0]); f[host[i]][0]+=f[i][0]; } } return max(f[0][0],f[0][1]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...