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>
// Find out best sample
int up(int p)
{
if(p>0)return p;else return 0;
}
int findSample(int n,int confidence[],int host[],int protocol[]){
int ans=0;
int i;
for(i=n-1;i>0;i--)
{
if(protocol[i]==0)
{
confidence[host[i]]-=confidence[i];
ans+=confidence[i];
}
else if(protocol[i]==1)
{
confidence[host[i]]=up(confidence[host[i]])+up(confidence[i]);
}
else if(protocol[i]==2)
{
confidence[host[i]]=std::max(up(confidence[host[i]]),up(confidence[i]));
}
}
return ans+up(confidence[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... |