Submission #741586

#TimeUsernameProblemLanguageResultExecution timeMemory
741586MODDIFriend (IOI14_friend)C++14
100 / 100
30 ms3348 KiB
#include "friend.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; pair<int,int> hold[100100]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 0; i < n; i++){ hold[i] = make_pair(confidence[i], 0); } for(int i = n - 1; i > 0; i--){ int p1 = hold[host[i]].first, q1 = hold[host[i]].second, p2 = hold[i].first, q2 = hold[i].second; if(protocol[i] == 0){ hold[host[i]].first = p1 + q2; hold[host[i]].second = max(p2 + q1, q1 + q2); } else if(protocol[i] == 1){ hold[host[i]].first = max(p1 + q2, max(p1 + p2, p2 + q1)); hold[host[i]].second = q1 + q2; } else{ hold[host[i]].first = max(p1 + q2, p2 + q1); hold[host[i]].second = q1 + q2; } } return max(hold[0].first, hold[0].second); }
#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...