제출 #94502

#제출 시각아이디문제언어결과실행 시간메모리
94502fjzzq2002친구 (IOI14_friend)C++14
100 / 100
32 ms3576 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...