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>
using namespace std;
int findSample(int n, int con[], int h[], int p[]) {
int sum=0;
for (int i=n-1; i>0; i--) {
int a=h[i], b=p[i], c=con[i];
if (b==2) con[a]=max(con[a], c);
if (b==1) con[a]+=c;
if (b==0) {
sum+=c;
con[a]=max(0, con[a]-c);
}
}
return sum+con[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... |