Submission #94501

#TimeUsernameProblemLanguageResultExecution timeMemory
94501fjzzq2002Friend (IOI14_friend)C++14
16 / 100
2 ms380 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; #define SZ 666666 int f[SZ],g[SZ]; int findSample(int n,int c[],int fa[],int p[]){ for(int i=0;i<n;++i) f[i]=c[i]; for(int i=n-1;i>=0;--i) { int t=fa[i]; if(p[i]==0) f[t]+=g[i],g[t]+=max(f[i],g[i]); else if(p[i]==1) f[t]=max(f[t]+max(f[i],g[i]),g[t]+f[i]),g[t]+=g[i]; else f[t]=max(f[t]+g[i],g[t]+f[i]),g[t]+=g[i]; } return max(f[0],g[0]); }
#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...