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>
using namespace std;
typedef long long ll;
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
ll ans=0;
vector<ll> w(n);
for(int i=0; i<n; i++){
w[i]=confidence[i];
}
for(int i=n-1; i>0; i--){
if(w[i]<0)continue;
if(protocol[i]==0){
w[host[i]]-=w[i];
ans+=w[i];
}
else if(protocol[i]==1){
w[host[i]]=max({w[host[i]], w[host[i]]+w[i], w[i]});
}
else{
w[host[i]]=max(w[host[i]], w[i]);
}
}
ans+=max(0ll, w[0]);
return ans;
}
# | 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... |