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;
int findSample(int n,int a[],int p[],int t[])
{
int ans=0;
for (int i=n-1;i>=0;i--)
{
if (a[i]<0)
continue;
if (!t[i])
{
ans+=a[i];
a[p[i]]-=a[i];
}
else if (t[i]==1)
a[p[i]]=max(a[p[i]],0)+a[i];
else
a[p[i]]=max(a[p[i]],a[i]);
}
return ans+max(a[0],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... |