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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
lli dp[1002][2];
vector<lli> hijos[1002];
lli conf[1002];
void DFS(lli pos, lli padre) {
for (auto h : hijos[pos]) {
if (h == padre) continue;
DFS(h,pos);
dp[pos][1] += dp[h][0];
dp[pos][0] += max(dp[h][0], dp[h][1]);
}
}
int findSample(int n,int confidence[],int host[],int protocol[]){
rep(i,1,n-1) {
hijos[i].push_back(host[i]);
hijos[host[i]].push_back(i);
}
rep(i,0,n-1) conf[i] = confidence[i];
DFS(0,0);
lli a = max(dp[0][0],dp[0][1]);
return a;
}
# | 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... |