제출 #16524

#제출 시각아이디문제언어결과실행 시간메모리
16524eaststar친구 (IOI14_friend)C++14
100 / 100
26 ms3036 KiB
#include "friend.h" #include <algorithm> using namespace std; int a[100010],b[100010]; int findSample(int n,int *c,int *h,int *p){ int i; for(i=0;i<n;++i)a[i]=c[i]; for(;--i;){ if(!p[i]){ a[h[i]]+=b[i]; b[h[i]]+=max(a[i],b[i]); } else if(p[i]==1){ a[h[i]]=max(a[h[i]]+max(a[i],b[i]),b[h[i]]+a[i]); b[h[i]]+=b[i]; } else{ a[h[i]]=max(a[h[i]]+b[i],b[h[i]]+a[i]); b[h[i]]+=b[i]; } } return max(a[0],b[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...