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;
// Find out best sample
int findSample(int n,int cf[],int h[],int pc[]){
int i,c=0;
for(i=n-1;i>0;i--){
if(pc[i]==0){
c+=cf[i];
cf[h[i]]=max(cf[h[i]]-cf[i],0);
}else if(pc[i]==1) cf[h[i]]+=cf[i];
else cf[h[i]]=max(cf[h[i]],cf[i]);
}
return c+cf[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... |