이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
int findSample(int n, int confidence[], int host[], int protocol[]) {
vector<int> yes(n), no(n, 0);
for (int i = 0; i < n; i++) yes[i] = confidence[i];
for (int i = n - 1; i >= 1; i--){
int par = host[i];
if (protocol[i] == 0){
yes[par] += no[i];
no[par] += max(yes[i], no[i]);
}
else if (protocol[i] == 1){
yes[par] = max(yes[par] + yes[i], max(yes[par] + no[i], no[par] + yes[i]));
no[par] += no[i];
}
else{
yes[par] = max(yes[par] + no[i], no[par] + yes[i]);
no[par] += no[i];
}
}
return max(yes[0], no[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... |