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 ;
const int N = 1e5 + 5 ;
int findSample(int n , int confidence[] , int host[] , int protocol[]){
int sol[n+1];
for(int i = 0 ; i < n; i++)
sol[i] = confidence[i] ;
int ret = 0 ;
for(int i = n-1 ; i>0 ; i--){
int p = protocol[i] ;
if(!p){
ret+=sol[i] ;
sol[host[i]] = max(0 , sol[host[i]] - sol[i]) ;
}
else if(p==1){
sol[host[i]] +=sol[i] ;
}
else{
sol[host[i]] = max(sol[host[i]] ,sol[i]) ;
}
}
return sol[0] + ret ;
}
# | 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... |