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;
const int maxn = 100005;
int p[maxn], q[maxn];
int findSample(int n,int confidence[],int host[],int protocol[]){
for(int x=0;x<n;x++) p[x] = confidence[x], q[x] = 0;
for(int x=n-1;x>0;x--) {
int y = host[x];
if(protocol[x]==0) {
p[y] = p[y] + q[x];
q[y] = q[y] + max(p[x], q[x]);
}
else if(protocol[x]==1) {
p[y] = max(p[y] + max(p[x], q[x]), p[x] + q[y]);
q[y] = q[y] + q[x];
}
else {
p[y] = max(p[y] + q[x], p[x] + q[y]);
q[y] = q[y] + q[x];
}
}
return max(p[0], q[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... |