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>
#include "friend.h"
using namespace std;
const int MAX=1e5+10;
const int INF=(1<<30);
int X[MAX], Y[MAX];
int findSample(int n, int confidence[], int host[], int protocol[])
{
for (int i = 0; i < n; i++)
{
X[i]=confidence[i];
}
for (int i=n-1; i>=1; i--)
{
if (protocol[i]==0)
{
X[host[i]]+=Y[i];
Y[host[i]]=max(Y[host[i]]+X[i],Y[host[i]]+Y[i]);
}
if (protocol[i]==1)
{
X[host[i]]=max({X[host[i]]+X[i],X[host[i]]+Y[i],Y[host[i]]+X[i]});
Y[host[i]]+=Y[i];
}
if (protocol[i]==2)
{
X[host[i]]=max(X[host[i]]+Y[i],Y[host[i]]+X[i]);
Y[host[i]]+=Y[i];
}
}
return max(X[0],Y[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... |