Submission #69296

#TimeUsernameProblemLanguageResultExecution timeMemory
69296VahanFriend (IOI14_friend)C++17
100 / 100
51 ms7424 KiB
#include "friend.h" #include<algorithm> using namespace std; int iranov[200000],aranc_ira[200000]; // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=0;i<n;i++) { iranov[i]=confidence[i]; aranc_ira[i]=0; } for(int i=n-1;i>=1;i--) { if(protocol[i]==0) { iranov[host[i]]=iranov[host[i]]+aranc_ira[i]; aranc_ira[host[i]]=max(aranc_ira[i]+aranc_ira[host[i]],iranov[i]+aranc_ira[host[i]]); } if(protocol[i]==1) { iranov[host[i]]=max(max(iranov[host[i]]+iranov[i],iranov[host[i]]+aranc_ira[i]),aranc_ira[host[i]]+iranov[i]); aranc_ira[host[i]]=aranc_ira[host[i]]+aranc_ira[i]; } if(protocol[i]==2) { iranov[host[i]]=max(iranov[host[i]]+aranc_ira[i],iranov[i]+aranc_ira[host[i]]); aranc_ira[host[i]]=aranc_ira[host[i]]+aranc_ira[i]; } } return max(aranc_ira[host[1]],iranov[host[1]]); }
#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...