Submission #7288

#TimeUsernameProblemLanguageResultExecution timeMemory
7288gs13068Friend (IOI14_friend)C++98
100 / 100
36 ms3040 KiB
#include "friend.h" #include <algorithm> int d1[100000]; int d2[100000]; int findSample(int n,int c[],int h[],int p[]) { int i; for(i=0;i<n;i++)d1[i]=c[i]; for(i=n-1;i>0;i--) { if(p[i]==0) { d1[h[i]]+=d2[i]; d2[h[i]]+=std::max(d1[i],d2[i]); } if(p[i]==1) { d1[h[i]]=std::max(d2[h[i]]+d1[i],d1[h[i]]+std::max(d1[i],d2[i])); d2[h[i]]+=d2[i]; } if(p[i]==2) { d1[h[i]]=std::max(d2[h[i]]+d1[i],d1[h[i]]+d2[i]); d2[h[i]]+=d2[i]; } } return std::max(d1[0],d2[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...