This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |