Submission #46826

#TimeUsernameProblemLanguageResultExecution timeMemory
46826MatheusLealVLibrary (JOI18_library)C++17
19 / 100
2096 ms676 KiB
#include <bits/stdc++.h>
#define Nmax 1005
#include "library.h"
using namespace std;

#define f first
#define s second

typedef pair<int, int> pii;

int n, used[Nmax], conta = 0;

void Solve(int N_)
{
	n = N_;

	if(n == 1)
	{
		vector<int> aux(1);

		aux[0] = 1;

		return Answer(aux);
	}

	vector<int> ans;

	for(int i = 1; i <= n; i++)
	{
		vector<int> v(n);

		for(int j = 0; j < n; j++) v[j] = 1;

		v[i - 1] = 0;

		if(Query(v) == 1)
		{			
			used[i] = 1;

			ans.push_back(i);

			break;
		}
	}

	for(int i = 1; i < n; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			if(used[j]) continue;

			vector<int> atual(n);

			for(int z = 0; z < ans.size(); z++)
			{
				atual[ ans[z] - 1] = 1;
			}

			atual[j - 1] = 1;

			if(Query(atual) == 1)
			{
				used[j] = 1;

				ans.push_back(j);

				break;
			}
		}
	}

	Answer(ans);
}

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:54:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int z = 0; z < ans.size(); z++)
                   ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...