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;
typedef long long int ll;
typedef vector<vector<int>> vii;
#define pb push_back
#define sz(a) (int)(a.size())
int p[100000],q[100000];
int findSample(int n,int confidence[],int h[],int protocol[]){
for(int i=0;i<n;i++)p[i] = confidence[i];
for(int i=n-1;i>0;i--){
if(protocol[i] == 0){
p[h[i]] = p[h[i]] + q[i];
q[h[i]] = q[h[i]] + max(p[i],q[i]);
}else if(protocol[i] == 1){
p[h[i]] = max(p[h[i]] + max(p[i],q[i]) , p[i] + q[h[i]]);
q[h[i]] = q[h[i]] + q[i];
}else{
p[h[i]] = max(p[h[i]] + q[i],p[i] + q[h[i]]);
q[h[i]] = q[h[i]] + q[i];
}
}
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... |