Submission #344023

# Submission time Handle Problem Language Result Execution time Memory
344023 2021-01-05T04:50:36 Z tengiz05 Library (JOI18_library) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "library.h"
#include "grader.cpp"
using namespace std;
void Solve(int n){
	vector<vector<int>> v(n);
	for(int i=0;i<n;i++){
		vector<int> ask(n, 0);
		ask[i] = 1;
		for(int j=i+1;j<n;j++){
			ask[j] = 1;
			if(Query(ask) == 1)v[i].push_back(j), v[j].push_back(i);
			ask[j] = 0;
		}
	}
	for(int i=0;i<n;i++){for(auto x : v[i])cout << x << ' ';cout << '\n';}
	vector<bool> used(n);
	vector<int> ans;
	int u=-1;
	for(int i=0;i<n;i++){
		if(v[i].size() == 1){
			u = i;break;
		}
	}
	assert(u != -1);
	while(true){
		bool ch = false;
		used[u] = true;
		ans.push_back(u+1);
		for(auto to : v[u]){
			if(!used[to]){
				ch=true;
				u=to;
			}
		}if(!ch)break;
	}
	Answer(ans);
	return;
}

/*

5
4 2 5 3 1

*/

Compilation message

/tmp/ccrzrKaR.o: In function `Query(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x0): multiple definition of `Query(std::vector<int, std::allocator<int> > const&)'
/tmp/ccX5mayW.o:grader.cpp:(.text+0x0): first defined here
/tmp/ccrzrKaR.o:(.bss+0x0): multiple definition of `__my_judge_::judge'
/tmp/ccX5mayW.o:(.bss+0x0): first defined here
/tmp/ccrzrKaR.o: In function `Answer(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x10): multiple definition of `Answer(std::vector<int, std::allocator<int> > const&)'
/tmp/ccX5mayW.o:grader.cpp:(.text+0x390): first defined here
/tmp/ccrzrKaR.o: In function `main':
library.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccX5mayW.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status