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>
#define debug printf
#define lp(i,a,b) for(int i = a ; i < b ; i++ )
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define ll long long
#define sz size()
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define tiii tuple<int,int,int>
#define mkt make_tuple
const int MAXN = 1e5+10 ;
using namespace std ;
int dontGet[MAXN] ;
int findSample(int n,int get[],int host[],int protocol[])
{
for(int i = n-1 ; i > 0 ; i-- )
{
protocol[i] ++ ;
if( protocol[i] == 1 )
{
get[ host[i] ] += dontGet[i] ;
dontGet[ host[i] ] += max(get[i], dontGet[i] ) ;
}
else if( protocol[i] == 2 )
{
get[ host[i] ] = max(get[host[i]] , dontGet[host[i]]) + max( get[i] , dontGet[i] ) ;
dontGet[ host[i] ] += dontGet[i] ;
}
else if( protocol[i] == 3 )
{
get[host[i]] = max( get[host[i]] + dontGet[i] , get[i] + dontGet[host[i]] ) ;
dontGet[ host[i] ] += dontGet[i] ;
}
}
return max(get[0] , dontGet[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... |