제출 #73308

#제출 시각아이디문제언어결과실행 시간메모리
73308zscoderTriangles (CEOI18_tri)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "trilib.c"

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*
static int n;
static long long *x, *y;
static int queries=0;

static void init() {
	static int is_inited=0;
	if (is_inited)
		return;
	is_inited=1;
	assert(scanf("%d", &n)==1);
	x=(long long*)malloc((n+1)*sizeof(long long));
	y=(long long*)malloc((n+1)*sizeof(long long));
	for (int i=1; i<=n; i++)
		assert(scanf("%lld%lld", &x[i], &y[i])==2);
}

int get_n() {
	init();
	return n;
}

int is_clockwise(int a, int b, int c) {
	init();
	assert(a>=1 && a<=n);
	assert(b>=1 && b<=n);
	assert(c>=1 && c<=n);
	assert(a!=b && a!=c && b!=c);
	queries++;
        if(queries == 1000 * 1000 + 1)
            printf("Too many queries!");
	return (x[b]-x[a])*(y[c]-y[a])-(x[c]-x[a])*(y[b]-y[a])<0;
}

void give_answer(int s) {
	init();
	printf("%d\n", s);
}
*/
int nn; int god;
bool is_cl(int x, int y, int z)
{
	return is_clockwise(x+1,y+1,z+1);
}
bool cmp(int x, int y)
{
	return is_cl(god,x,y);
}
int ans;

void solve_init(int u)
{
	vector<int> vec;
	for(int i=0;i<nn;i++)
	{
		if(u!=i) vec.pb(i);
	}
	god=u;
	stable_sort(vec.begin(),vec.end(),cmp);
	vector<int> S;
	S.pb(u);
	S.pb(vec[0]); S.pb(vec[1]);
	for(int i=2;i<vec.size();i++)
	{
		int u=vec[i];
		while(S.size()>=2&&!is_cl(S[int(S.size())-2], S[int(S.size())-1], u))
		{
			S.pop_back();
		}
		S.pb(u);
	}
	ans=min(ans,int(S.size()));
}

int main()
{
	nn = get_n();
	ans = nn;
	for(int i=0;i<nn;i++)
	{
		if(n>500&&i>=2) break;
		solve_init(i);
	}
	give_answer(ans);
}

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

tri.cpp: In function 'void solve_init(int)':
tri.cpp:82:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=2;i<vec.size();i++)
              ~^~~~~~~~~~~
/tmp/ccnpseSg.o: In function `get_n':
tri.cpp:(.text+0xf0): multiple definition of `get_n'
/tmp/ccvfT0LY.o:trilib.c:(.text+0xf0): first defined here
/tmp/ccnpseSg.o: In function `is_clockwise':
tri.cpp:(.text+0x120): multiple definition of `is_clockwise'
/tmp/ccvfT0LY.o:trilib.c:(.text+0x120): first defined here
/tmp/ccnpseSg.o: In function `give_answer':
tri.cpp:(.text+0x2b0): multiple definition of `give_answer'
/tmp/ccvfT0LY.o:trilib.c:(.text+0x280): first defined here
collect2: error: ld returned 1 exit status