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;
int notake[100005];
int findSample(int n, int take[], int host[], int protocol[]) {
for(int v = n-1;v >= 1;v--){
int u = host[v];
if(protocol[v] == 0){ //I Am Your Friend
take[u] += notake[v];
notake[u] += max(take[v],notake[v]);
}
else if(protocol[v] == 1){ //My Friends Are Your Friends
take[u] = max(take[u]+take[v],max(take[u]+notake[v],notake[u]+take[v]));
notake[u] += notake[v];
}
else{
take[u] = max(take[u]+notake[v],notake[u]+take[v]);
notake[u] += notake[v];
}
}
return max(take[0],notake[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... |