Submission #139478

# Submission time Handle Problem Language Result Execution time Memory
139478 2019-07-31T20:40:31 Z MohamedAhmed04 Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
#include "library.h"
#include "grader.cpp"

using namespace std;

int l[2005] , r[2005] , marked[2005];

void Solve(int N)
{
	memset(marked , 0 , sizeof(marked)) ;
	memset(l , -1 , sizeof(l)) ;
	memset(r , -1 , sizeof(r)) ;
	vector<int> M(N);
	for(int i = 0 ; i < N ; ++i)
		M[i] = 0 ;
	for(int i = 0 ; i < N ; ++i)
	{
		for(int j = i+1 ; j < N ; ++j)
		{
			M[i] = 1 ;
			M[j] = 1 ;
			int x = Query(M) ;
			M[i] = 0 ;
			M[j] = 0 ;
			if(x == 1)
			{
				if(l[i] == -1)
					l[i] = j ;
				else
					r[i] = j ;
				if(l[j] == -1)
					l[j] = i ;
				else
					r[j] = i ;
			}
		}
	}
	vector<int>res(N) ;
	int nxt = -1 ;
	for(int i = 0 ; i < N ; ++i)
	{
		if(r[i] == -1)
		{
			nxt = i ;
			break ;
		}
	}
	res[0] = nxt + 1 ;
	marked[nxt] = 1 ;
	nxt = l[nxt] ;
	for(int i = 1 ; i < N ; ++i)
	{
		res[i] = nxt+1 ;
		marked[nxt] = 1 ;
		if(marked[l[nxt]])
			nxt = r[nxt] ;
		else
			nxt = l[nxt] ;
	}
	Answer(res) ;
}

Compilation message

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