Submission #1324819

#TimeUsernameProblemLanguageResultExecution timeMemory
1324819tsetsenbileg친구 (IOI14_friend)C++20
0 / 100
0 ms332 KiB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
using pr = pair<int, int>;
const int INF = 1e9+7, MOD = 1e9+7;

// Find out best sample
int findSample(int n,int a[],int host[],int type[]){
	int aa = 0, bb = 0;
	for (int i = 1; i < n; i++) {
		if (type[i] == 0) aa++;
		else bb++;
	}
	return max(aa, bb);
	// int res = 0;
	// vector<vector<int>> dp(n, vector<int> (2, 0)); 
	// // 0 with person i included
	// // 1 without person i (includes friends)
	// // 2 without person i and friends
	// // dp[0][0] = a[0];
	// for (int i = 0; i < n; i++) dp[i][1] = a[i];
	// for (int i = 1; i < n; i++) {
	// 	int h = host[i];
	// 	if (type[i] == 0) {
	// 		dp[h][0] += max(dp[i][0], dp[i][1]);
	// 		dp[h][1] += dp[i][0];
	// 		// dp[i][1] = dp[h][0];
	// 		// dp[i][0] = dp[h][1];
	// 	}
	// 	else if (type[i] == 1) {
	// 		// dp[h][0] = max(dp[h][0], dp[i][0] + dp[h][1]);
	// 		dp[h][0] = max(dp[i][0] + dp[h][0], dp[i][1]);
	// 		dp[h][1] += max(dp[i][1], dp[i][0]);
	// 		// dp[i][0] = dp[h][0];
	// 		// dp[i][1] = dp[h][1];
	// 	}
	// 	else {
	// 		dp[h][0] = max(dp[h][0] + dp[i][0], dp[i][1]);
	// 		dp[h][1] += dp[i][0];
	// 		// dp[i][0] = dp[h][1];
	// 		// dp[i][0] = dp[h][0];
	// 		// dp[i][1] = dp[h][0];
	// 	}
	// 	res = max(res, dp[i][0]);
	// 	res = max(res, dp[i][1]);
	// }
	// return res;
}
#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...