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;
int findSample(int n, int confidence[], int host[], int protocol[]){
vector<int> c(confidence, confidence + n);
int ans = 0;
for (int i = n - 1; i >= 1; i--) {
if (protocol[i] == 0) {
c[host[i]] -= c[i];
ans += c[i];
}
if (protocol[i] == 1) {
c[host[i]] += c[i];
}
if (protocol[i] == 2) {
c[host[i]] = max(c[host[i]], c[i]);
}
};
ans += (c[0] > 0 ? c[0] : 0);
return 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... |