Submission #465639

#TimeUsernameProblemLanguageResultExecution timeMemory
465639blueFriend (IOI14_friend)C++17
100 / 100
29 ms3452 KiB
#include "friend.h" #include <vector> using namespace std; int findSample(int n,int confidence[],int host[],int protocol[]){ vector<int> Yes(n, 0), No(n, 0); for(int i = 0; i < n; i++) Yes[i] += confidence[i]; for(int i = n-1; i >= 1; i--){ if(protocol[i] == 0) { Yes[ host[i] ] += No[i]; No[ host[i] ] += max(Yes[i], No[i]); } else if(protocol[i] == 1){ Yes[ host[i] ] = max(Yes[ host[i] ] + max(Yes[i], No[i]), No[ host[i] ] + Yes[i]); No[ host[i] ] += No[i]; } else{ Yes[ host[i] ] = max(Yes[ host[i] ] + No[i], No[ host[i] ] + Yes[i]); No[ host[i] ] += No[i]; } } return max(Yes[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...