#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
/*
SUBTASK 4
vector<int> take, not_take;
vector<vector<int>> children;
void dfs(int u, int confidence[]){
take[u] += confidence[u];
for (int v : children[u]){
dfs(v, confidence);
take[u] += not_take[v];
not_take[u] += max(not_take[v], take[v]);
}
}
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
children.resize(n);
for (int i=1; i<n; i++){
children[host[i]].push_back(i);
}
take = not_take = vector<int>(n);
dfs(0, confidence);
return max(take[0], not_take[0]);
}*/
/*
SUBTASK 2
int findSample(int n,int confidence[],int host[],int protocol[]){
int ans = 0;
for (int i=0; i<n; i++) ans += confidence[i];
return ans;
}
*/
int findSample(int n,int confidence[],int host[],int protocol[]){
int ans = 0;
for (int i=0; i<n; i++) ans = max(confidence[i], ans);
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... |