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>
#ifndef ARTHUR_LOCAL
#include "friend.h"
#endif
using namespace std;
const int MAXN=1000;
int C[MAXN];
int H[MAXN];
int P[MAXN];
int ans[2][MAXN];
int findSample(int n, int C_raw[], int H_raw[], int P_raw[])
{
for(int i=0; i<n; i++)
{
C[i]=C_raw[i];
H[i]=H_raw[i];
P[i]=P_raw[i];
}
ans[1][0] = C[0];
for(int i=1; i<n; i++)
{
if(P[i]==0)
{
ans[0][i] = ans[1][H[i]];
ans[1][i] = max(ans[0][H[i]]+C[i],ans[1][H[i]]);
}
if(P[i]==1)
{
ans[0][i] = ans[1][H[i]];
ans[1][i] = max(ans[1][H[i]],C[i]+C[H[i]]);
}
}
return ans[1][n];
}
# | 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... |