이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |