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"
#define MX 100001
int D[MX],cnt;
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
int i;
for(i=n;i>=0;i--){D[i]=confidence[i];}
for(i=n-1;i>=1;i--){
if(protocol[i]==0){
cnt+=D[i];
D[host[i]]-=D[i];
D[host[i]]=D[host[i]]>0?D[host[i]]:0;
D[i]=0;
}
if(protocol[i]==1){
D[host[i]]+=D[i];
D[i]=0;
}
if(protocol[i]==2){
D[host[i]]=D[host[i]]>D[i]?D[host[i]]:D[i];
D[i]=0;
}
}
return cnt+D[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... |