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 findSample(int n,int confidence[],int host[],int protocol[]){
vector<int> lb(n, 0);
vector<int> ub(n, 0);
for (int i=0; i<n; i++)
ub[i] = confidence[i];
for (int i=n-1; i>=1; i--)
{
int h = host[i];
int p = protocol[i];
if (p == 1)
{
lb[h] = lb[h]+lb[i];
ub[h] = ub[h]+ub[i];
}
else if (p==2)
{
lb[h] = max(lb[h], lb[i]);
ub[h] = max(ub[h], ub[i]);
}
else
{
lb[h] = lb[h] + ub[i];
ub[h] = ub[h] + lb[i];
ub[h] = max(ub[h], lb[h]);
}
}
return max(lb[0], ub[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... |