제출 #121210

#제출 시각아이디문제언어결과실행 시간메모리
121210_7_7_Triangles (CEOI18_tri)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; const int N = 1e5 + 11; int n; long long *x, *y; int queries=0; bool was[N]; 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(); s = 0; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) { if (i == j) continue; bool ok = 1; for (int x = 1; x <= n; ++x) { if (i == x || j == x) continue; if (!is_clockwise(i, j, x)) { ok = 0; break; } } if (ok) { if (!was[i]) { ++s; was[i] = 1; } if (!was[j]) { was[j] = 1; ++s; } } } printf("%d\n", s); }

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

/tmp/ccec4klv.o: In function `get_n':
tri.cpp:(.text+0xf0): multiple definition of `get_n'
/tmp/ccp4fNau.o:trilib.c:(.text+0xf0): first defined here
/tmp/ccec4klv.o: In function `is_clockwise':
tri.cpp:(.text+0x120): multiple definition of `is_clockwise'
/tmp/ccp4fNau.o:trilib.c:(.text+0x120): first defined here
/tmp/ccec4klv.o: In function `give_answer':
tri.cpp:(.text+0x280): multiple definition of `give_answer'
/tmp/ccp4fNau.o:trilib.c:(.text+0x280): first defined here
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status