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 <algorithm>
using namespace std;
int a[100010],b[100010];
int findSample(int n,int *c,int *h,int *p){
int i;
for(i=0;i<n;++i)a[i]=c[i];
for(;--i;){
if(!p[i]){
a[h[i]]+=b[i];
b[h[i]]+=max(a[i],b[i]);
}
else if(p[i]==1){
a[h[i]]=max(a[h[i]]+max(a[i],b[i]),b[h[i]]+a[i]);
b[h[i]]+=b[i];
}
else{
a[h[i]]=max(a[h[i]]+b[i],b[h[i]]+a[i]);
b[h[i]]+=b[i];
}
}
return max(a[0],b[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... |