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"
int findSample(int n, int confidence[], int host[], int protocol[]) {
long long res = 0;
for (int u = n - 1; u > 0; u--) {
int v = host[u];
if (protocol[u] == 0) {
confidence[v] -= confidence[u];
if (confidence[v] < 0)
confidence[v] = 0;
res += confidence[u];
} else if (protocol[u] == 1) {
confidence[v] += confidence[u];
} else if (confidence[u] > confidence[v]) {
confidence[v] = confidence[u];
}
}
return res + confidence[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... |