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> foo(confidence, confidence + n), bar(n, 0);
for (int i = n - 1; i; --i) {
int j = host[i];
if (protocol[i] == 0) {
foo[j] += bar[i];
bar[j] += max(foo[i], bar[i]);
} else if (protocol[i] == 1) {
foo[j] = max(foo[j] + max(foo[i], bar[i]), bar[j] + foo[i]);
bar[j] += bar[i];
} else {
foo[j] = max(foo[j] + bar[i], bar[j] + foo[i]);
bar[j] += bar[i];
}
}
return max(foo[0], bar[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... |