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"
#include <iostream>
#include <algorithm>
using namespace std;
int x1[100009], x2[100009];
int findSample(int n, int confidence[], int host[], int protocol[]) {
for (int i = 0; i < n; i++) x1[i] = confidence[i];
for (int i = n - 1; i >= 1; i--) {
if (protocol[i] == 2) { int D1 = max({ x1[host[i]] + x2[i], x2[host[i]] + x1[i] }), D2 = x2[host[i]] + x2[i]; x1[host[i]] = D1; x2[host[i]] = D2; }
if (protocol[i] == 1) { int D1 = max({ x1[host[i]] + x1[i], x1[host[i]] + x2[i], x2[host[i]] + x1[i] }), D2 = x2[host[i]] + x2[i]; x1[host[i]] = D1; x2[host[i]] = D2; }
if (protocol[i] == 0) { int D1 = max({ x2[host[i]] + x1[i], x2[host[i]] + x2[i] }), D2 = x1[host[i]] + x2[i]; x1[host[i]] = D2; x2[host[i]] = D1; }
}
return max(x1[0], x2[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... |