제출 #173821

#제출 시각아이디문제언어결과실행 시간메모리
173821CaroLinda친구 (IOI14_friend)C++14
27 / 100
2 ms632 KiB
#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 )
		{

			dontGet[ host[i] ] += dontGet[i] ;
			get[i] = max(get[host[i]] , dontGet[host[i]]) + max( get[i] , dontGet[i] ) ;

		}

		else if( protocol[i] == 3 )
		{

			dontGet[ host[i] ] += dontGet[i] ;
			
			get[host[i]] = max( get[host[i]] + dontGet[i] , get[i] + dontGet[host[i]] ) ;

		}

	}

	return max(get[0] , dontGet[0]) ;
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...