제출 #116281

#제출 시각아이디문제언어결과실행 시간메모리
116281nvmdavaFriend (IOI14_friend)C++17
35 / 100
6 ms428 KiB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;

// Find out best sample

int ie[100005], oe[100005];

int findSample(int n,int confidence[],int host[],int protocol[]){
	
	for(int i = 0; i < n; i++)
		ie[i] = confidence[i];
	
	for(int i = n - 1; i > 0; i--){
		int j = host[i];
		if(protocol[i] == 0){
			oe[j] += max(ie[i], oe[i]);
			ie[j] += oe[i];
		} else if(protocol[i] == 1){
			ie[j] += max(ie[i], oe[i]);
			oe[j] += oe[i];
		} else {
			ie[j] = max(ie[j] + oe[i], oe[j] + ie[i]);
			oe[j] += oe[i];
		}
	}
	
	return max(ie[0], oe[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...