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 <bits/stdc++.h>
using namespace std;
int p[100007], q[100007];
int findSample(int n,int confidence[],int host[],int protocol[]) {
for(int i = 0 ; i < n ; i++)
p[i] = confidence[i];
for(int i = n - 1 ; i > 0 ; i--) {
int j = host[i], np, nq;
if(protocol[i] == 0) {
np = max(p[i] + q[j], q[i] + p[j]);
nq = max(p[i], q[i]) + q[j];
} else if(protocol[i] == 1) {
np = max({p[i] + q[j], q[i] + p[j], p[i] + p[j]});
nq = q[i] + q[j];
} else {
np = max(p[i] + q[j], q[i] + p[j]);
nq = q[i] + q[j];
}
p[j] = np;
q[j] = nq;
}
return max(p[0], q[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... |