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 <bits/stdc++.h>
using namespace std;
int ie[100005], oe[100005];
int findSample(int n,int confidence[],int host[],int protocol[]){
for(int i = 0; i < n; i++)
ie[i] = confidence[i];
for(int i = n - 1; i > 0; i--){
int j = host[i];
if(protocol[i] == 0){
oe[j] += max(ie[i], oe[i]);
ie[j] += oe[i];
} else if(protocol[i] == 1){
ie[j] = max(ie[i] + ie[j], max(ie[j] + oe[i], oe[j] + ie[i]));
oe[j] += oe[i];
} else {
ie[j] = max(ie[j] + oe[i], oe[j] + ie[i]);
oe[j] += oe[i];
}
}
return max(ie[0], oe[0]);
}
# | 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... |