Submission #1097487

#TimeUsernameProblemLanguageResultExecution timeMemory
1097487Alihan_8Library (JOI18_library)C++17
19 / 100
231 ms592 KiB
#include "library.h"

#include <bits/stdc++.h>

using namespace std;

#define pb push_back

void Solve(int n){
	vector <int> ans, us(n);
	
	int lst = -1;
	
	for ( int x = 0; x < n; x++ ){
		vector <int> t, e;
		
		for ( int i = 0; i < n; i++ ){
			if ( !us[i] ) t.pb(i);
			else e.pb(i);
		}
		
		if ( x + 1 == n ){
			ans.pb(t[0] + 1);
			break;
		}
		
		vector <int> M(n);
		
		for ( auto &u: t ) M[u] = 1;
		
		for ( auto &j: t ){
			if ( j == lst ) continue;
			
			M[j] = 0;
			
			if ( Query(M) == 1 ){
				if ( lst == -1 ){
					lst = j;
				} else{
					ans.pb(j + 1);
					us[j] = 1;
				} 
			}
			
			M[j] = 1;
		}
	}
	
	Answer(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...