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>
#define ll long long
#define N 100100
using namespace std;
// Find out best sample
int x,f[N],g[N];
int findSample(int n,int confidence[],int host[],int protocol[]){
memset(f,0,sizeof(f));
memset(g,0,sizeof(g));
for(int i=0;i<n;++i)
f[i]=confidence[i];
for(int i=n-1;i>0;--i){
x=host[i];
if(protocol[i]==0)f[x]+=g[i],g[x]+=max(f[i],g[i]);
else if(protocol[i]==1)f[x]+=max(f[i],g[i]),g[x]+=g[i];
else f[x]=max(f[x]+g[i],g[x]+max(g[i],f[i])),g[x]+=g[i];
}
return max(f[0],g[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... |