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 <iostream>
using namespace std;
const int nmax=100005;
int best[nmax][2];
int a[nmax],val[nmax];
int nr,p,tip,i,tt;
int findSample(int n,int confidence[],int host[],int protocol[]){
for(i=0;i<n;i++)
best[i][1]=confidence[i];
for(int i=n-1;i>=1;i--)
{
tt=host[i];tip=protocol[i];
if(tip==0)
{
best[tt][0]+=max(best[i][0],best[i][1]);
best[tt][1]+=best[i][0];
}
if(tip==1)
{
best[tt][0]+=best[i][0];
best[tt][1]=max(max(best[tt][0]+best[i][1],best[tt][1]+best[i][0]),best[tt][1]+best[i][1]);
}
if(tip==2)
{
best[tt][0]+=best[i][0];
best[tt][1]=max(best[tt][0]+best[i][1],best[tt][1]+best[i][0]);
}
}
return max(best[0][0],best[0][1]);
}
# | 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... |