Submission #528806

#TimeUsernameProblemLanguageResultExecution timeMemory
528806c28dnv9q3Monster Game (JOI21_monster)C++17
0 / 100
178 ms396 KiB
#include "monster.h"
#include <bitset>
#include <iostream>
using namespace std;

vector<int> Solve(int N) {
	vector<int> T(N);
	vector<bitset<1000>> results(N);
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			if (i == j)
				continue;
			if (Query(i, j))
			{
				results[i].set(j);
			}
			else
			{
				results[j].set(i);
			}
		}
	}
	int max1 = -1, max2 = -1;
	int penMax = -1;

	int min1 = -1, min2 = -1;
	int penMin = -1;
	for (int i = 0; i <N; ++i)
	{
		T[i] = results[i].count();
		if (T[i] == N - 2)
		{
			if (max1 != -1)
				max2 = i;
			else
				max1 = i;
		}
		if (T[i] == N - 3)
			penMax = i;

		if (T[i] == 1)
		{
			if (min1 != -1)
				min2 = i;
			else
				min1 = i;
		}
		if (T[i] == 2)
			penMin = i;

	}
	
	if (results[max1].test(penMax))
	{
		T[max1] = N - 1;
	}
	else
	{
		T[max2] = N - 1;
	}
	if (results[min1].test(penMin))
	{
		T[min2] = 0;
	}
	else
		T[min1] = 0;



  return T;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...