Submission #1327489

#TimeUsernameProblemLanguageResultExecution timeMemory
1327489nanaseyuzukiLibrary (JOI18_library)C++20
0 / 100
127 ms416 KiB
#include <bits/stdc++.h>
#include "library.h"
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
using namespace std;

#ifdef LOCAL
#include "C:\Users\Dell\Downloads\template\template\icpc-notebook\Utilities\debug.h"
#else
#define debug(...) 42
#endif

const int mn = 5e5 + 5, mod = 1e9 + 7, inf = 2e9;

int n;
vector <int> a[1005], res;

void dfs(int u, int p){
	res.push_back(u);
	for(auto v : a[u]){
		if(v == p) continue;
		dfs(v, u);
	}
}

void Solve(int N) {
    n = N;
    for(int i = 1; i <= n; i++){
    	for(int j = i + 1; j <= n; j++){
    		vector <int> tv;
    		for(int k = 1; k <= n; k ++){
    			if(k != i && k != j) tv.push_back(0);
    			else tv.push_back(1);
    		}
    		// cout << i << ' ' << j << ' ' << Query(tv) << '\n';
    		if(Query(tv) == 1){
    			a[i].push_back(j);
    			a[j].push_back(i);
    		}
    	}
    }

    for(int i = 1; i <= n; i++){
	    if(a[i].size() == 1){
	    	dfs(i, 0);
	    	break;
	    }
    }
    // for(auto i : res) cout << i << ' ';
    // cout << '\n';
    Answer(res);
}
// Don't wanna lose anymore T_T
// Never let me go - Kazuo Ishiguro
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...