답안 #168611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168611 2019-12-14T09:17:40 Z johutha 친구 (IOI14_friend) C++14
0 / 100
2 ms 380 KB
#include "friend.h"
#include <vector>
#include <iostream>
#include <algorithm>

#define int int64_t

using namespace std;

// Find out best sample
signed findSample(signed n, signed confidence[], signed host[], signed protocol[])
{
	vector<int> take;
	for (int i = 0; i < n; i++) take.push_back(confidence[i]);
	vector<int> nottake(n, 0);

	for (int i = 1; i < n; i++)
	{
		int hs = host[i];
		if (protocol[i] == 0)
		{
			take[i] += nottake[hs];
			nottake[i] += max(take[hs], nottake[hs]);
		}
		else if (protocol[i] == 1)
		{
			take[i] = max(take[i] + max(take[hs], nottake[hs]), nottake[i] + take[hs]);
			nottake[i] += nottake[hs];
		}
		else
		{
			take[i] = max(take[i] + nottake[hs], take[hs] + nottake[i]);
			nottake[i] += nottake[hs];
		}
		
	}


	return max(take[n - 1], nottake[n - 1]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -