Submission #101324

#TimeUsernameProblemLanguageResultExecution timeMemory
101324b2563125Library (JOI18_library)C++14
0 / 100
3087 ms444 KiB
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include"library.h"
using namespace std;
#define vel vector<int>
#define vvel vector<vel>
#define vvvel vector<vvel>
#define veb vector<bool>
void mmax(int &a, int b) { a = max(a, b); }
bool che(int i, int j, int n) {
	vel a(n, 0);
	a[i] = 1; a[j] = 1;
	return Query(a) == 1;
}
void Solve(int n) {
	if (n == 1) { vel res(1, 1); Answer(res); }
	vvel con(n);
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (che(i, j,n)) { con[i].push_back(j); con[j].push_back(i); }
		}
	}
	int th;
	for (int i = 0; i < n; i++) {
		if (con[i].size() == 1) { th = i; }
	}
	veb seen(n,false);
	seen[th] = true;
	vel ans(1, th + 1);
	th = con[th][0];
	while (con[th].size() > 1) {
		seen[th] = true;
		ans.push_back(th + 1);
		if (seen[con[th][0]]) { th = con[th][1]; }
		else { th = con[th][0]; }
	}
	ans.push_back(th + 1);
	Answer(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...