Submission #874279

#TimeUsernameProblemLanguageResultExecution timeMemory
874279YongXinFriend (IOI14_friend)C++14
100 / 100
22 ms1840 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int no[100000]; int findSample(int n,int confidence[],int host[],int protocol[]){ ios_base::sync_with_stdio(false);cin.tie(NULL); for(int i=n-1;i>0;--i){ switch(protocol[i]){ case 0: confidence[host[i]]+=no[i]; no[host[i]]+=max(confidence[i],no[i]); break; case 1: confidence[host[i]]=max(confidence[host[i]]+confidence[i],max(confidence[host[i]]+no[i],no[host[i]]+confidence[i])); no[host[i]]+=no[i]; break; case 2: confidence[host[i]]=max(confidence[host[i]]+no[i],no[host[i]]+confidence[i]); no[host[i]]+=no[i]; } } return max(confidence[0],no[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...