제출 #230994

#제출 시각아이디문제언어결과실행 시간메모리
230994peijar동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define SZ(v) ((int)(v).size())

void answer(vector<int> S, vector<int> D);
int tryCombination(vector<int> S);

void exploreCave(int nb_portes)
{
	vector<int> switches(nb_portes);
	vector<bool> fixed(nb_portes);
	int lst_ans(tryCombination(switches));

	auto flip_range = [&](int left, int right)
	{
		for (int i(left); i <= right; ++i)
			if (!fixed[i])
				switches[i] ^= 1;
	};

	vector<int> portes(nb_portes);

	for (int i(0); i < nb_portes; ++i)
	{
		int lft(0), rgt(nb_portes);
		while (lft < rgt)
		{
			int mid = (lft + rgt)/2;
			flip_range(lft, mid);
			int nxt_ans = tryCombination(switches);
			flip_range(lft, mid);
			if ((lst_ans < i+1 and nxt_ans >= i+1) or (lst_ans >= i+1 and nxt_ans < i+1))
				rgt = mid;
			else
				lft = mid+1;
		}
		if (lst_ans < i+1)
			switches[lft] ^= 1;
		fixed[lft] = true;
		portes[i] = lft;
	}
	answer(switches, portes);
}

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccZN0WN4.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
/tmp/ccWLAhBE.o: In function `exploreCave(int)':
cave.cpp:(.text+0x1ca): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
cave.cpp:(.text+0x348): undefined reference to `tryCombination(std::vector<int, std::allocator<int> >)'
cave.cpp:(.text+0x524): undefined reference to `answer(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status