Submission #418301

#TimeUsernameProblemLanguageResultExecution timeMemory
418301Bill_00Friend (IOI14_friend)C++14
46 / 100
37 ms5580 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; // Find out best sample int p[1000005],q[1000005]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=0;i<n;i++){ p[i]=confidence[i]; } for(int i=n-1;i>=1;i--){ if(protocol[i]==0){ p[host[i]]=p[host[i]]+q[i]; q[host[i]]=q[host[i]]+max(q[i],p[i]); } if(protocol[i]==1){ p[host[i]]=max(max(p[host[i]+q[i]],p[i]+q[host[i]]),p[host[i]]+p[i]); q[host[i]]=q[i]+q[host[i]]; } if(protocol[i]==2){ p[host[i]]=max(p[host[i]]+q[i],q[host[i]]+p[i]); q[host[i]]=q[i]+q[host[i]]; } } return max(p[0],q[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...