제출 #299620

#제출 시각아이디문제언어결과실행 시간메모리
299620BertedTriangles (CEOI18_tri)C++14
컴파일 에러
0 ms0 KiB
#include "trilib.h"
#include "trilib.c"
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>

using namespace std;

int N;
vector<int> data, p1, p2;

bool comp(const int &l, const int &r)
{
	return !is_clockwise(1, l, r);
}

int main()
{
	N = get_n();
	for (int i = 3; i <= n; i++)
	{
		if (is_clockwise(1, i, 2)) {p2.push_back(i);}
		else {p1.push_back(i);}
	}

	sort(p1.begin(), p1.end(), comp);
	for (auto &x : p1) {data.push_back(x);}
	data.push_back(2);
	sort(p2.begin(), p2.end(), comp);
	for (auto &x : p2) {data.push_back(x);}


	//for (auto &x : data) {cout << x << " ";} cout << "\n";

	deque<int> stack;
	stack.push_back(1);
	for (auto &x : data)
	{
		while (stack.size() > 1 && is_clockwise(stack[stack.size() - 2], stack.back(), x)) {stack.pop_back();}
		stack.push_back(x);
		//cout << "inserted " << x << "\n";
	}

	//for (auto &x : stack) {cout << x << " ";} cout << "\n";

	while (stack.size() > 2)
	{
		if (is_clockwise(stack.front(), stack[1], stack.back())) {stack.pop_front();}
		else if (is_clockwise(stack.back(), stack.front(), stack[stack.size() - 2])) {stack.pop_back();}
		else {break;}
	}

	//for (auto &x : stack) {cout << x << " ";} cout << "\n";

	give_answer(stack.size());
	return 0;
}

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

/tmp/cc3eRhmB.o: In function `get_n':
tri.cpp:(.text+0x100): multiple definition of `get_n'
/tmp/ccV9zid7.o:trilib.c:(.text+0x100): first defined here
/tmp/cc3eRhmB.o: In function `is_clockwise':
tri.cpp:(.text+0x120): multiple definition of `is_clockwise'
/tmp/ccV9zid7.o:trilib.c:(.text+0x120): first defined here
/tmp/cc3eRhmB.o: In function `give_answer':
tri.cpp:(.text+0x280): multiple definition of `give_answer'
/tmp/ccV9zid7.o:trilib.c:(.text+0x260): first defined here
collect2: error: ld returned 1 exit status