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 MAXN = 1E5+5;
int val[MAXN];
int findSample(int n,int confidence[],int host[],int protocol[]){
int ans = 0;
for (int i =0; i < n; i++) val[i] = confidence[i];
for (int i = n; i > 0; i--) {
int v = host[i];
int t = protocol[i];
if (t == 1) {
val[v] += val[i];
}
else if (t == 2) {
val[v] = max(val[v],val[i]);
}
else {
ans += val[i];
val[v] = max (0,val[v] - val[i]);
}
}
return val[0] + ans;
}
# | 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... |