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 N = 100005;
int v[N], cv[N];
int findSample(int n, int confidence[], int host[], int protocol[])
{
for (int i = 0; i < n; ++i)
{
v[i] = confidence[i];
cv[i] = 0;
}
for (int i = n - 1; i > 0; --i)
{
if (protocol[i] == 0)
{
v[host[i]] = v[host[i]] + cv[i];
cv[host[i]] = max(cv[host[i]] + v[i], cv[host[i]] + cv[i]);
}
else if (protocol[i] == 2)
{
v[host[i]] = max(v[host[i]] + cv[i], cv[host[i]] + v[i]);
cv[host[i]] = cv[host[i]] + cv[i];
}
else
{
v[host[i]] = max(max(v[host[i]] + cv[i], cv[host[i]] + v[i]), v[host[i]] + v[i]);
cv[host[i]] = cv[host[i]] + cv[i];
}
}
return max(v[0], cv[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... |