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[100010] , q[100010] ;
int findSample(int n,int confi[],int host[],int prt[]){
int ans = 0;
for(int i = 0 ; i< n; i++) p[i] = confi[i] ;
for(int i=n-1;i>0;i--){
int x = host[i] ; int y = i ;
int u = 0 , nu = 0 ;
if(prt[i] == 0){
u = p[x] + q[y] ; nu = max(p[y] + q[x] , q[x] + q[y]) ;
}
else if(prt[i] == 1){
u = max(max(p[x] + p[y] , p[x] + q[y]) , p[y] + q[x]) ;
nu = q[x] + q[y] ;
}
else{
u = max(p[x] + q[y] , p[y] + q[x]) ;
nu = q[x] + q[y] ;
}
p[x] = u ; q[x] = nu ;
ans = max(ans , max(u , nu )) ;
}
return ans;
}
# | 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... |