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