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 "grader.cpp"
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
#define pb(n) push_back(n)
int findSample(int n,int c[],int h[],int p[]){
int ans=0;
for(int i=n;i>0;i--){
if(p[i]==0){
ans+=c[i];
c[h[i]]=max(0,c[h[i]]-c[i]);
}else if(p[i]==2){
c[h[i]]=max(c[h[i]],c[i]);
}else{
c[h[i]]+=c[i];
}
}
ans+=c[0];
return ans;
}
/*
6
13 3 6 20 10 15
0 0 1 1 2 0
0 0 1 1 1 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... |