#include "friend.h"
#include<bits/stdc++.h>
using namespace std;
int findSample(int n, int confidence[], int host[], int protocol[]){
int cost[n], tot = 0; for(int i = 0; i < n; i++) cost[i] = confidence[i];
for(int i = n-1; i > 0; i--){
if(protocol[i] == 2){cost[host[i]] = max(cost[host[i]],cost[i]);}
else if(protocol[i] == 1){cost[host[i]] += cost[i];}
else{
tot += cost[i];
cost[host[i]] -= min(cost[host[i]], cost[i]);
}
}
tot += cost[0];
return tot;
}
# | 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... |